Bot will seach for another video if the selected video cannot be played
This commit is contained in:
parent
82a25dbe09
commit
eb3a5d2990
|
@ -2,7 +2,6 @@ package com.fpghoti.biscuit.audio;
|
||||||
|
|
||||||
import com.fpghoti.biscuit.Main;
|
import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||||
import com.fpghoti.biscuit.util.Util;
|
|
||||||
import com.sedmelluq.discord.lavaplayer.player.AudioLoadResultHandler;
|
import com.sedmelluq.discord.lavaplayer.player.AudioLoadResultHandler;
|
||||||
import com.sedmelluq.discord.lavaplayer.tools.FriendlyException;
|
import com.sedmelluq.discord.lavaplayer.tools.FriendlyException;
|
||||||
import com.sedmelluq.discord.lavaplayer.track.AudioPlaylist;
|
import com.sedmelluq.discord.lavaplayer.track.AudioPlaylist;
|
||||||
|
@ -18,78 +17,48 @@ public class AudioResultHandler implements AudioLoadResultHandler {
|
||||||
private String searchPhrase;
|
private String searchPhrase;
|
||||||
private boolean search;
|
private boolean search;
|
||||||
private boolean first;
|
private boolean first;
|
||||||
private boolean stop;
|
private boolean playAfterQueue;
|
||||||
|
|
||||||
public AudioResultHandler(Biscuit biscuit, String uid, TextChannel channel, boolean search,
|
public AudioResultHandler(String uid, TextChannel channel, boolean search, String searchPhrase, boolean first, boolean playAfterQueue) {
|
||||||
String searchPhrase, boolean first, boolean stop) {
|
this.biscuit = Biscuit.getBiscuit(channel.getGuild());
|
||||||
this.biscuit = biscuit;
|
|
||||||
this.uid = uid;
|
this.uid = uid;
|
||||||
this.channel = channel;
|
this.channel = channel;
|
||||||
this.search = search;
|
this.search = search;
|
||||||
this.searchPhrase = searchPhrase;
|
this.searchPhrase = searchPhrase;
|
||||||
this.first = first;
|
this.first = first;
|
||||||
this.stop = stop;
|
this.playAfterQueue = playAfterQueue;
|
||||||
}
|
|
||||||
|
|
||||||
public AudioResultHandler(Biscuit biscuit, String uid, TextChannel channel, boolean search,
|
|
||||||
String searchPhrase, boolean first) {
|
|
||||||
this.biscuit = biscuit;
|
|
||||||
this.uid = uid;
|
|
||||||
this.channel = channel;
|
|
||||||
this.search = search;
|
|
||||||
this.searchPhrase = searchPhrase;
|
|
||||||
this.first = first;
|
|
||||||
this.stop = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AudioResultHandler(Biscuit biscuit, String uid, TextChannel channel, boolean search, String searchPhrase) {
|
|
||||||
this.biscuit = biscuit;
|
|
||||||
this.uid = uid;
|
|
||||||
this.channel = channel;
|
|
||||||
this.search = search;
|
|
||||||
this.searchPhrase = searchPhrase;
|
|
||||||
this.first = false;
|
|
||||||
this.stop = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void trackLoaded(AudioTrack track) {
|
public void trackLoaded(AudioTrack track) {
|
||||||
if(!stop) {
|
|
||||||
//TODO fix vevo
|
|
||||||
//Try to avoid Vevo results if possible.
|
|
||||||
String title = track.getInfo().title;
|
|
||||||
if(title.toLowerCase().contains("vevo") || track.getInfo().author.toLowerCase().contains("vevo")) {
|
|
||||||
title = title.toLowerCase().replace("vevo", "") + " lyrics";
|
|
||||||
channel.sendMessage("You tried to load a Vevo video. These are not compatible with the music player."
|
|
||||||
+ " Trying to find alternate song...").queue();
|
|
||||||
Main.getPlayerManager().loadItemOrdered(biscuit.getGuild(),"ytsearch:" + title, new AudioResultHandler(biscuit, uid, channel, true, title, first, true));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
channel.sendMessage("**Adding to queue: **\n```" + track.getInfo().title + "\nBy: "
|
|
||||||
+ track.getInfo().author + "\nLength: " + Util.getTime(track.getDuration()) +"```").queue();
|
|
||||||
if(first) {
|
if(first) {
|
||||||
biscuit.getAudioScheduler().queueFirst(track, uid, channel);
|
biscuit.getAudioScheduler().queue(track, uid, channel, 1);
|
||||||
}else {
|
}else {
|
||||||
biscuit.getAudioScheduler().queue(track, uid, channel);
|
biscuit.getAudioScheduler().queue(track, uid, channel);
|
||||||
}
|
}
|
||||||
|
if(playAfterQueue) {
|
||||||
|
biscuit.getAudioScheduler().startPlaying();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void playlistLoaded(AudioPlaylist playlist) {
|
public void playlistLoaded(AudioPlaylist playlist) {
|
||||||
AudioTrack track = playlist.getTracks().get(0);
|
AudioTrack track = playlist.getTracks().get(0);
|
||||||
channel.sendMessage("**Adding to queue: **\n" + track.getInfo().uri + "\n```" + track.getInfo().title + "\nBy: "
|
if(first) {
|
||||||
+ track.getInfo().author + "\nLength: " + Util.getTime(track.getDuration()) +"```").queue();
|
biscuit.getAudioScheduler().queue(track, uid, channel, 1);
|
||||||
biscuit.getAudioScheduler().queue(track, uid);
|
}else {
|
||||||
|
biscuit.getAudioScheduler().queue(track, uid, channel);
|
||||||
|
}
|
||||||
|
if(playAfterQueue) {
|
||||||
|
biscuit.getAudioScheduler().startPlaying();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void noMatches() {
|
public void noMatches() {
|
||||||
if(!search) {
|
if(!search) {
|
||||||
biscuit.log("Exact match not found. Searching instead...");
|
biscuit.log("Exact match not found. Searching instead...");
|
||||||
Main.getPlayerManager().loadItemOrdered(biscuit.getGuild(),"ytsearch:" + searchPhrase, new AudioResultHandler(biscuit, uid, channel, true, searchPhrase));
|
Main.getPlayerManager().loadItemOrdered(biscuit.getGuild(),"ytsearch:" + searchPhrase, new AudioResultHandler(uid, channel, true, searchPhrase, first, false));
|
||||||
}else {
|
}else {
|
||||||
channel.sendMessage("Song match not found.").queue();
|
channel.sendMessage("Song match not found.").queue();
|
||||||
}
|
}
|
||||||
|
@ -101,4 +70,6 @@ public class AudioResultHandler implements AudioLoadResultHandler {
|
||||||
channel.sendMessage("An error was encountered while attempting to load audio.").queue();
|
channel.sendMessage("An error was encountered while attempting to load audio.").queue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,10 @@ package com.fpghoti.biscuit.audio;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.audio.queue.AudioQueue;
|
import com.fpghoti.biscuit.audio.queue.AudioQueue;
|
||||||
import com.fpghoti.biscuit.audio.queue.QueuedTrack;
|
import com.fpghoti.biscuit.audio.queue.QueuedTrack;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||||
import com.fpghoti.biscuit.util.Util;
|
|
||||||
import com.sedmelluq.discord.lavaplayer.player.AudioPlayer;
|
import com.sedmelluq.discord.lavaplayer.player.AudioPlayer;
|
||||||
import com.sedmelluq.discord.lavaplayer.player.event.AudioEventAdapter;
|
import com.sedmelluq.discord.lavaplayer.player.event.AudioEventAdapter;
|
||||||
import com.sedmelluq.discord.lavaplayer.tools.FriendlyException;
|
import com.sedmelluq.discord.lavaplayer.tools.FriendlyException;
|
||||||
|
@ -52,9 +52,15 @@ public class AudioScheduler extends AudioEventAdapter {
|
||||||
switch(endReason) {
|
switch(endReason) {
|
||||||
|
|
||||||
case LOAD_FAILED:
|
case LOAD_FAILED:
|
||||||
warn("Something went wrong while trying to load the current track. The next track will be played instead if available.");
|
warn("Something went wrong while trying to load the current track. Trying alternate track.");
|
||||||
if(qt != null && qt.getCommandChannel() != null)
|
if(!qt.triedAlternative()) {
|
||||||
qt.getCommandChannel().sendMessage("There was an error loading **" + title + "**.").queue();
|
qt.useAttempt();
|
||||||
|
TextChannel channel = qt.getCommandChannel();
|
||||||
|
channel.sendMessage("The video selected cannot be played through the music player. An alternate track will be played if available.").queue();
|
||||||
|
title = title.toLowerCase().replace("vevo", "") + " lyrics";
|
||||||
|
Main.getPlayerManager().loadItemOrdered(biscuit.getGuild(),"ytsearch:" + title, new AudioResultHandler(qt.getUserId(), channel, true, title, true, !queue.isEmpty()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case CLEANUP:
|
case CLEANUP:
|
||||||
log("A track stopped playing due to audio player cleanup.");
|
log("A track stopped playing due to audio player cleanup.");
|
||||||
|
@ -77,7 +83,7 @@ public class AudioScheduler extends AudioEventAdapter {
|
||||||
|
|
||||||
if (endReason.mayStartNext) {
|
if (endReason.mayStartNext) {
|
||||||
if(loop) {
|
if(loop) {
|
||||||
queueFirst(track.makeClone(), qt.getUserId(), qt.getCommandChannel());
|
queue(track.makeClone(), qt.getUserId(), qt.getCommandChannel(), 1);
|
||||||
}
|
}
|
||||||
startPlaying();
|
startPlaying();
|
||||||
}
|
}
|
||||||
|
@ -85,12 +91,11 @@ public class AudioScheduler extends AudioEventAdapter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTrackException(AudioPlayer player, AudioTrack track, FriendlyException exception) {
|
public void onTrackException(AudioPlayer player, AudioTrack track, FriendlyException exception) {
|
||||||
//TODO fix vevo
|
|
||||||
if(track.getInfo().title.toLowerCase().contains("vevo") || track.getInfo().author.toLowerCase().contains("vevo")) {
|
|
||||||
QueuedTrack qt = queue.getPreviousTrack(track);
|
QueuedTrack qt = queue.getPreviousTrack(track);
|
||||||
qt.getCommandChannel().sendMessage("**" + track.getInfo().title + "** could not be loaded, because it is a Vevo video.").queue();
|
if(!qt.triedAlternative()) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
biscuit.error("An exception occurred while trying to play a certain track. The next track will be played instead if available.");
|
warn("No alternative track found. This means the video is most likely unavailable. The next track will be played instead if available.");
|
||||||
startPlaying();
|
startPlaying();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,26 +107,23 @@ public class AudioScheduler extends AudioEventAdapter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void queue(AudioTrack track, String uid) {
|
public void queue(AudioTrack track, String uid, TextChannel channel) {
|
||||||
queue(track, uid, null);
|
queue(track, uid, channel, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void queue(AudioTrack track, String uid, TextChannel channel) {
|
public void queue(AudioTrack track, String uid, TextChannel channel, Integer place) {
|
||||||
if(queue.isEmpty() && biscuit.getAudioPlayer().getPlayingTrack() == null) {
|
if(queue.isEmpty() && biscuit.getAudioPlayer().getPlayingTrack() == null) {
|
||||||
queue.addPreviousTrack(new QueuedTrack(biscuit, track, uid, channel));
|
QueuedTrack qt = new QueuedTrack(biscuit, track, uid, channel);
|
||||||
|
queue.sendQueueMessage(qt);
|
||||||
|
queue.addPreviousTrack(qt);
|
||||||
biscuit.getAudioPlayer().playTrack(track);
|
biscuit.getAudioPlayer().playTrack(track);
|
||||||
|
}else {
|
||||||
|
if(place != null) {
|
||||||
|
queue.addAtPlace(new QueuedTrack(biscuit, track, uid, channel), place);
|
||||||
}else {
|
}else {
|
||||||
queue.add(new QueuedTrack(biscuit, track, uid, channel));
|
queue.add(new QueuedTrack(biscuit, track, uid, channel));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void queueFirst(AudioTrack track, String uid, TextChannel channel) {
|
|
||||||
if(queue.isEmpty() && biscuit.getAudioPlayer().getPlayingTrack() == null) {
|
|
||||||
queue.addPreviousTrack(new QueuedTrack(biscuit, track, uid, channel));
|
|
||||||
biscuit.getAudioPlayer().playTrack(track);
|
|
||||||
}else {
|
|
||||||
queue.addAtPlace(new QueuedTrack(biscuit, track, uid, channel), 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startPlaying() {
|
public void startPlaying() {
|
||||||
|
@ -170,29 +172,6 @@ public class AudioScheduler extends AudioEventAdapter {
|
||||||
startPlaying();
|
startPlaying();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNextMessage() {
|
|
||||||
if(queue.isEmpty()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
AudioTrack track = queue.getNext().getTrack();
|
|
||||||
return getMessage(track);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMessage(AudioTrack track) {
|
|
||||||
return getMessage(track, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMessage(AudioTrack track, Boolean showRemaining) {
|
|
||||||
String msg ="**Now Playing: **\n" + track.getInfo().uri + "\n```" + track.getInfo().title + "\nBy: "
|
|
||||||
+ track.getInfo().author + "\nLength: " + Util.getTime(track.getDuration());
|
|
||||||
if(showRemaining) {
|
|
||||||
msg = msg + "\nTime Remaining: " + Util.getTime(track.getDuration() - track.getPosition()) + "```";
|
|
||||||
}else {
|
|
||||||
msg = msg + "```";
|
|
||||||
}
|
|
||||||
return msg;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void wipeQueue() {
|
public void wipeQueue() {
|
||||||
queue.clear();
|
queue.clear();
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,9 @@ import java.util.ArrayList;
|
||||||
|
|
||||||
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
||||||
|
|
||||||
|
import net.dv8tion.jda.api.entities.MessageEmbed;
|
||||||
|
import net.dv8tion.jda.api.entities.TextChannel;
|
||||||
|
|
||||||
public class AudioQueue {
|
public class AudioQueue {
|
||||||
|
|
||||||
private ArrayList<QueuedTrack> tracks;
|
private ArrayList<QueuedTrack> tracks;
|
||||||
|
@ -77,20 +80,33 @@ public class AudioQueue {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(QueuedTrack track) {
|
public void add(QueuedTrack track) {
|
||||||
|
sendQueueMessage(track);
|
||||||
tracks.add(track);
|
tracks.add(track);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Goes by viewable place rather than index for
|
//Goes by viewable place rather than index for
|
||||||
//easy implementation into command.
|
//easy implementation into command.
|
||||||
public boolean addAtPlace(QueuedTrack track, int place) {
|
public boolean addAtPlace(QueuedTrack track, int place) {
|
||||||
if(place < 1 || place > tracks.size()) {
|
if(place < 1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int index = place - 1;
|
int index = place - 1;
|
||||||
|
if(index > tracks.size()) {
|
||||||
|
index = tracks.size();
|
||||||
|
}
|
||||||
|
sendQueueMessage(track);
|
||||||
tracks.add(index, track);
|
tracks.add(index, track);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void sendQueueMessage(QueuedTrack track) {
|
||||||
|
if(track.getCommandChannel() != null) {
|
||||||
|
TextChannel c = track.getCommandChannel();
|
||||||
|
MessageEmbed m = track.getEmbedMessage("Queued:");
|
||||||
|
c.sendMessage(m).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Goes by viewable place rather than index for
|
//Goes by viewable place rather than index for
|
||||||
//easy implementation into command.
|
//easy implementation into command.
|
||||||
public boolean moveToPlace(int oldPlace, int newPlace) {
|
public boolean moveToPlace(int oldPlace, int newPlace) {
|
||||||
|
@ -114,6 +130,9 @@ public class AudioQueue {
|
||||||
}
|
}
|
||||||
|
|
||||||
public QueuedTrack getNext() {
|
public QueuedTrack getNext() {
|
||||||
|
if(isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return tracks.get(0);
|
return tracks.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,14 @@
|
||||||
package com.fpghoti.biscuit.audio.queue;
|
package com.fpghoti.biscuit.audio.queue;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||||
|
import com.fpghoti.biscuit.util.Util;
|
||||||
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
||||||
|
|
||||||
|
import net.dv8tion.jda.api.EmbedBuilder;
|
||||||
import net.dv8tion.jda.api.entities.Member;
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
|
import net.dv8tion.jda.api.entities.MessageEmbed;
|
||||||
import net.dv8tion.jda.api.entities.TextChannel;
|
import net.dv8tion.jda.api.entities.TextChannel;
|
||||||
|
|
||||||
public class QueuedTrack {
|
public class QueuedTrack {
|
||||||
|
@ -12,12 +17,14 @@ public class QueuedTrack {
|
||||||
private AudioTrack track;
|
private AudioTrack track;
|
||||||
private String userId;
|
private String userId;
|
||||||
private TextChannel channel;
|
private TextChannel channel;
|
||||||
|
private boolean triedAlternative;
|
||||||
|
|
||||||
public QueuedTrack(Biscuit biscuit, AudioTrack track, String userId, TextChannel channel) {
|
public QueuedTrack(Biscuit biscuit, AudioTrack track, String userId, TextChannel channel) {
|
||||||
this.biscuit = biscuit;
|
this.biscuit = biscuit;
|
||||||
this.track = track;
|
this.track = track;
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
this.channel = channel;
|
this.channel = channel;
|
||||||
|
this.triedAlternative = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Biscuit getBiscuit() {
|
public Biscuit getBiscuit() {
|
||||||
|
@ -40,4 +47,60 @@ public class QueuedTrack {
|
||||||
return channel;
|
return channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MessageEmbed getEmbedMessage(String prefix) {
|
||||||
|
return getEmbedMessage(prefix, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MessageEmbed getEmbedMessage(String prefix, boolean showRemaining) {
|
||||||
|
EmbedBuilder embed = new EmbedBuilder();
|
||||||
|
|
||||||
|
String title = track.getInfo().title;
|
||||||
|
if(prefix != null && !prefix.equals("")) {
|
||||||
|
title = prefix + " " + title;
|
||||||
|
}
|
||||||
|
|
||||||
|
embed.setTitle(title, track.getInfo().uri);
|
||||||
|
embed.setColor(Color.CYAN);
|
||||||
|
|
||||||
|
String desc = "Author: " + track.getInfo().author + "\nLength: " + Util.getTime(track.getDuration());
|
||||||
|
|
||||||
|
if(showRemaining) {
|
||||||
|
desc = desc + "\nTime Remaining: " + Util.getTime(track.getDuration() - track.getPosition());
|
||||||
|
}
|
||||||
|
|
||||||
|
embed.setDescription(desc);
|
||||||
|
|
||||||
|
String name = biscuit.getGuild().getSelfMember().getEffectiveName();
|
||||||
|
String avatar = biscuit.getGuild().getSelfMember().getUser().getEffectiveAvatarUrl();
|
||||||
|
|
||||||
|
Member m = getMember();
|
||||||
|
if(m != null) {
|
||||||
|
name = m.getEffectiveName();
|
||||||
|
avatar = m.getUser().getEffectiveAvatarUrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
embed.setAuthor(name, null, avatar);
|
||||||
|
|
||||||
|
if(isYouTube()) {
|
||||||
|
embed.setThumbnail("https://img.youtube.com/vi/" + track.getIdentifier() + "/mqdefault.jpg");
|
||||||
|
}
|
||||||
|
|
||||||
|
return embed.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean triedAlternative() {
|
||||||
|
return triedAlternative;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Indicates an attempt has been made to search for another video
|
||||||
|
//Prevent and endless loop
|
||||||
|
public void useAttempt() {
|
||||||
|
triedAlternative = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isYouTube() {
|
||||||
|
return track.getInfo().uri.contains("https://www.youtube.com/watch?v=");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,14 +12,14 @@ import com.fpghoti.biscuit.commands.base.MusicClientCommand;
|
||||||
import com.fpghoti.biscuit.util.PermUtil;
|
import com.fpghoti.biscuit.util.PermUtil;
|
||||||
import com.fpghoti.biscuit.util.Util;
|
import com.fpghoti.biscuit.util.Util;
|
||||||
|
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||||
|
|
||||||
public class CommandManager {
|
public class CommandManager {
|
||||||
|
|
||||||
private static List<BaseCommand> commands = new ArrayList<BaseCommand>();
|
private static List<BaseCommand> commands = new ArrayList<BaseCommand>();
|
||||||
|
|
||||||
public static void parse(String message, MessageReceivedEvent e){
|
public static void parse(String message, GuildMessageReceivedEvent event){
|
||||||
Biscuit b = Biscuit.getBiscuit(e.getGuild());
|
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||||
ArrayList<String> split = new ArrayList<String>();
|
ArrayList<String> split = new ArrayList<String>();
|
||||||
String fixed = message.replaceFirst(b.getProperties().getCommandSignifier(), "");
|
String fixed = message.replaceFirst(b.getProperties().getCommandSignifier(), "");
|
||||||
String[] splitMsg = fixed.split(" ");
|
String[] splitMsg = fixed.split(" ");
|
||||||
|
@ -30,7 +30,7 @@ public class CommandManager {
|
||||||
String[] args = new String[split.size() - 1];
|
String[] args = new String[split.size() - 1];
|
||||||
split.subList(1, split.size()).toArray(args);
|
split.subList(1, split.size()).toArray(args);
|
||||||
|
|
||||||
dispatch(e, label, args);
|
dispatch(event, label, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,16 +38,16 @@ public class CommandManager {
|
||||||
return dispatch(null,label,args);
|
return dispatch(null,label,args);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean dispatch(MessageReceivedEvent e, String label, String[] args) {
|
public static boolean dispatch(GuildMessageReceivedEvent event, String label, String[] args) {
|
||||||
Biscuit b = Main.getMainBiscuit();
|
Biscuit b = Main.getMainBiscuit();
|
||||||
boolean isMain = true;
|
boolean isMain = true;
|
||||||
if(e != null) {
|
if(event != null) {
|
||||||
b = Biscuit.getBiscuit(e.getGuild());
|
b = Biscuit.getBiscuit(event.getGuild());
|
||||||
isMain = false;
|
isMain = false;
|
||||||
if(Util.contains(b.getProperties().disabledCommands(), label)) {
|
if(Util.contains(b.getProperties().disabledCommands(), label)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(!PermUtil.isAdmin(e.getMember()) && Util.contains(b.getProperties().disabledUserCommands(), label)) {
|
if(!PermUtil.isAdmin(event.getMember()) && Util.contains(b.getProperties().disabledUserCommands(), label)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,17 +79,17 @@ public class CommandManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trimmedArgs == null || (trimmedArgs.length > 0 && trimmedArgs[0].equals("?"))) {
|
if (trimmedArgs == null || (trimmedArgs.length > 0 && trimmedArgs[0].equals("?"))) {
|
||||||
commandReply(e, "``Command:" + " " + match.getName() + "``");
|
commandReply(event, "``Command:" + " " + match.getName() + "``");
|
||||||
commandReply(e, "``Description:" + " " + match.getDescription() + "``");
|
commandReply(event, "``Description:" + " " + match.getDescription() + "``");
|
||||||
commandReply(e, "``Usage:" + " " + match.getUsage() + "``");
|
commandReply(event, "``Usage:" + " " + match.getUsage() + "``");
|
||||||
List<String> notes = match.getNotes();
|
List<String> notes = match.getNotes();
|
||||||
for (String note : notes) {
|
for (String note : notes) {
|
||||||
commandReply(e, note);
|
commandReply(event, note);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(match instanceof ClientCommand && e != null) {
|
if(match instanceof ClientCommand && event != null) {
|
||||||
((ClientCommand)match).execute(trimmedArgs, e);
|
((ClientCommand)match).execute(trimmedArgs, event);
|
||||||
}else if(match instanceof ConsoleCommand && e == null) {
|
}else if(match instanceof ConsoleCommand && event == null) {
|
||||||
((ConsoleCommand)match).execute(trimmedArgs);
|
((ConsoleCommand)match).execute(trimmedArgs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,29 +97,29 @@ public class CommandManager {
|
||||||
if(Util.contains(Main.getMainBiscuit().getProperties().getCustomCmds(), label)) {
|
if(Util.contains(Main.getMainBiscuit().getProperties().getCustomCmds(), label)) {
|
||||||
CustomCommand cc = new CustomCommand(label, Main.getMainBiscuit());
|
CustomCommand cc = new CustomCommand(label, Main.getMainBiscuit());
|
||||||
if(args.length >= 1) {
|
if(args.length >= 1) {
|
||||||
commandReply(e, "``Command:" + " " + cc.getName() + "``");
|
commandReply(event, "``Command:" + " " + cc.getName() + "``");
|
||||||
commandReply(e, "``Description:" + " " + cc.getDescription() + "``");
|
commandReply(event, "``Description:" + " " + cc.getDescription() + "``");
|
||||||
commandReply(e, "``Usage:" + " " + cc.getUsage() + "``");
|
commandReply(event, "``Usage:" + " " + cc.getUsage() + "``");
|
||||||
}else {
|
}else {
|
||||||
commandReply(e, CustomCommand.fixPlaceholders(e, cc.getMessage()));
|
commandReply(event, CustomCommand.fixPlaceholders(event, cc.getMessage()));
|
||||||
}
|
}
|
||||||
}else if(!isMain && Util.contains(b.getProperties().getCustomCmds(), label)) {
|
}else if(!isMain && Util.contains(b.getProperties().getCustomCmds(), label)) {
|
||||||
CustomCommand cc = new CustomCommand(label, b);
|
CustomCommand cc = new CustomCommand(label, b);
|
||||||
if(args.length >= 1) {
|
if(args.length >= 1) {
|
||||||
commandReply(e, "``Command:" + " " + cc.getName() + "``");
|
commandReply(event, "``Command:" + " " + cc.getName() + "``");
|
||||||
commandReply(e, "``Description:" + " " + cc.getDescription() + "``");
|
commandReply(event, "``Description:" + " " + cc.getDescription() + "``");
|
||||||
commandReply(e, "``Usage:" + " " + cc.getUsage() + "``");
|
commandReply(event, "``Usage:" + " " + cc.getUsage() + "``");
|
||||||
}else {
|
}else {
|
||||||
commandReply(e, CustomCommand.fixPlaceholders(e, cc.getMessage()));
|
commandReply(event, CustomCommand.fixPlaceholders(event, cc.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void commandReply(MessageReceivedEvent e, String msg) {
|
public static void commandReply(GuildMessageReceivedEvent event, String msg) {
|
||||||
if(e != null) {
|
if(event != null) {
|
||||||
e.getTextChannel().sendMessage(msg).queue();
|
event.getChannel().sendMessage(msg).queue();
|
||||||
}else {
|
}else {
|
||||||
Main.getLogger().info(msg);
|
Main.getLogger().info(msg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.fpghoti.biscuit.commands.BaseCommand;
|
||||||
import com.fpghoti.biscuit.commands.CommandType;
|
import com.fpghoti.biscuit.commands.CommandType;
|
||||||
|
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||||
|
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||||
|
|
||||||
public abstract class ClientCommand extends BaseCommand{
|
public abstract class ClientCommand extends BaseCommand{
|
||||||
|
|
||||||
|
@ -11,7 +12,7 @@ public abstract class ClientCommand extends BaseCommand{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract void execute(String[] args, MessageReceivedEvent event);
|
public abstract void execute(String[] args, GuildMessageReceivedEvent event);
|
||||||
|
|
||||||
public CommandType getType() {
|
public CommandType getType() {
|
||||||
return CommandType.CLIENT;
|
return CommandType.CLIENT;
|
||||||
|
|
|
@ -4,11 +4,11 @@ import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||||
import com.fpghoti.biscuit.commands.BaseCommand;
|
import com.fpghoti.biscuit.commands.BaseCommand;
|
||||||
import com.fpghoti.biscuit.commands.CommandType;
|
import com.fpghoti.biscuit.commands.CommandType;
|
||||||
|
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||||
|
|
||||||
public class CustomCommand extends BaseCommand {
|
public class CustomCommand extends BaseCommand {
|
||||||
|
|
||||||
public static String fixPlaceholders(MessageReceivedEvent event, String msg) {
|
public static String fixPlaceholders(GuildMessageReceivedEvent event, String msg) {
|
||||||
msg = msg.replace("<user>", event.getAuthor().getAsMention());
|
msg = msg.replace("<user>", event.getAuthor().getAsMention());
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package com.fpghoti.biscuit.commands.base;
|
package com.fpghoti.biscuit.commands.base;
|
||||||
|
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||||
|
|
||||||
public abstract class MusicClientCommand extends ClientCommand{
|
public abstract class MusicClientCommand extends ClientCommand{
|
||||||
|
|
||||||
public abstract void execute(String[] args, MessageReceivedEvent event);
|
public abstract void execute(String[] args, GuildMessageReceivedEvent event);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||||
import com.fpghoti.biscuit.commands.base.ClientCommand;
|
import com.fpghoti.biscuit.commands.base.ClientCommand;
|
||||||
import com.fpghoti.biscuit.util.Util;
|
import com.fpghoti.biscuit.util.Util;
|
||||||
|
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||||
|
|
||||||
public class AddCommand extends ClientCommand{
|
public class AddCommand extends ClientCommand{
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ public class AddCommand extends ClientCommand{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(String[] args, MessageReceivedEvent event) {
|
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||||
b.log(event.getAuthor().getName() + " issued a command: -add");
|
b.log(event.getAuthor().getName() + " issued a command: -add");
|
||||||
if(args[0] != null && Util.isDeciDigit(args[0]) && args[1] != null && Util.isDeciDigit(args[1])) {
|
if(args[0] != null && Util.isDeciDigit(args[0]) && args[1] != null && Util.isDeciDigit(args[1])) {
|
||||||
|
@ -30,7 +30,7 @@ public class AddCommand extends ClientCommand{
|
||||||
if(end.equals(".0")) {
|
if(end.equals(".0")) {
|
||||||
sum = sum.replace(".0","");
|
sum = sum.replace(".0","");
|
||||||
}
|
}
|
||||||
event.getTextChannel().sendMessage(args[0] + " + " + args[1] + " is **" + sum + "**.").queue();
|
event.getChannel().sendMessage(args[0] + " + " + args[1] + " is **" + sum + "**.").queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||||
import com.fpghoti.biscuit.commands.base.ClientCommand;
|
import com.fpghoti.biscuit.commands.base.ClientCommand;
|
||||||
|
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||||
|
|
||||||
public class ChanIDCommand extends ClientCommand{
|
public class ChanIDCommand extends ClientCommand{
|
||||||
|
|
||||||
|
@ -18,11 +18,11 @@ public class ChanIDCommand extends ClientCommand{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(String[] args, MessageReceivedEvent event) {
|
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||||
b.log(event.getAuthor().getName() + " issued a command: -chanid");
|
b.log(event.getAuthor().getName() + " issued a command: -chanid");
|
||||||
String id = event.getTextChannel().getId();
|
String id = event.getChannel().getId();
|
||||||
event.getTextChannel().sendMessage(id).queue();
|
event.getChannel().sendMessage(id).queue();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||||
import com.fpghoti.biscuit.commands.base.ClientCommand;
|
import com.fpghoti.biscuit.commands.base.ClientCommand;
|
||||||
import com.fpghoti.biscuit.util.Util;
|
import com.fpghoti.biscuit.util.Util;
|
||||||
|
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||||
|
|
||||||
public class DivideCommand extends ClientCommand{
|
public class DivideCommand extends ClientCommand{
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ public class DivideCommand extends ClientCommand{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(String[] args, MessageReceivedEvent event) {
|
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||||
b.log(event.getAuthor().getName() + " issued a command: -divide");
|
b.log(event.getAuthor().getName() + " issued a command: -divide");
|
||||||
if(args[0] != null && Util.isDeciDigit(args[0]) && args[1] != null && Util.isDeciDigit(args[1])) {
|
if(args[0] != null && Util.isDeciDigit(args[0]) && args[1] != null && Util.isDeciDigit(args[1])) {
|
||||||
|
@ -31,7 +31,7 @@ public class DivideCommand extends ClientCommand{
|
||||||
if(end.equals(".0")) {
|
if(end.equals(".0")) {
|
||||||
divide = divide.replace(".0","");
|
divide = divide.replace(".0","");
|
||||||
}
|
}
|
||||||
event.getTextChannel().sendMessage(args[0] + " / " + args[1] + " is **" + divide + "**.").queue();
|
event.getChannel().sendMessage(args[0] + " / " + args[1] + " is **" + divide + "**.").queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,8 @@ import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||||
import com.fpghoti.biscuit.commands.base.MusicClientCommand;
|
import com.fpghoti.biscuit.commands.base.MusicClientCommand;
|
||||||
import com.fpghoti.biscuit.util.PermUtil;
|
import com.fpghoti.biscuit.util.PermUtil;
|
||||||
|
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.entities.MessageEmbed;
|
||||||
|
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||||
|
|
||||||
public class ForceSkipCommand extends MusicClientCommand{
|
public class ForceSkipCommand extends MusicClientCommand{
|
||||||
|
|
||||||
|
@ -19,13 +20,14 @@ public class ForceSkipCommand extends MusicClientCommand{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(String[] args, MessageReceivedEvent event) {
|
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||||
b.log(event.getAuthor().getName() + " issued a command: -forceskip");
|
b.log(event.getAuthor().getName() + " issued a command: -forceskip");
|
||||||
if(PermUtil.isMod(event.getMember())) {
|
if(PermUtil.isMod(event.getMember())) {
|
||||||
event.getChannel().sendMessage("Force skipping current song.").queue();
|
event.getChannel().sendMessage("Force skipping current song.").queue();
|
||||||
if(b.getAudioScheduler().getNextMessage() != null ) {
|
if(b.getAudioScheduler().getQueue().getNext() != null ) {
|
||||||
event.getChannel().sendMessage(b.getAudioScheduler().getNextMessage()).queue();
|
MessageEmbed next = b.getAudioScheduler().getQueue().getNext().getEmbedMessage("Now Playing:");
|
||||||
|
event.getChannel().sendMessage(next).queue();
|
||||||
}
|
}
|
||||||
b.getAudioScheduler().skip();
|
b.getAudioScheduler().skip();
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ import com.fpghoti.biscuit.logging.BColor;
|
||||||
import com.fpghoti.biscuit.util.PermUtil;
|
import com.fpghoti.biscuit.util.PermUtil;
|
||||||
|
|
||||||
import net.dv8tion.jda.api.entities.Message;
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||||
|
|
||||||
public class GetConfigCommand extends ClientCommand{
|
public class GetConfigCommand extends ClientCommand{
|
||||||
|
|
||||||
|
@ -24,14 +24,14 @@ public class GetConfigCommand extends ClientCommand{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(String[] args, MessageReceivedEvent event) {
|
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||||
b.log(event.getAuthor().getName() + " issued a command: -getconfig");
|
b.log(event.getAuthor().getName() + " issued a command: -getconfig");
|
||||||
if(PermUtil.isAdmin(event.getMember())) {
|
if(PermUtil.isAdmin(event.getMember())) {
|
||||||
event.getTextChannel().sendFile(b.getConfig().getFile(), "config-" + b.getProperties().getGuildCode() + ".properties").queue();
|
event.getChannel().sendFile(b.getConfig().getFile(), "config-" + b.getProperties().getGuildCode() + ".properties").queue();
|
||||||
}else {
|
}else {
|
||||||
b.log(BColor.MAGENTA_BOLD + event.getAuthor().getName() + " lacks permission to view the config!");
|
b.log(BColor.MAGENTA_BOLD + event.getAuthor().getName() + " lacks permission to view the config!");
|
||||||
event.getTextChannel().sendMessage(event.getAuthor().getAsMention() + " You do not have "
|
event.getChannel().sendMessage(event.getAuthor().getAsMention() + " You do not have "
|
||||||
+ "permission to view the config.").queue(new Consumer<Message>()
|
+ "permission to view the config.").queue(new Consumer<Message>()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,7 +5,7 @@ import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||||
import com.fpghoti.biscuit.commands.base.ClientCommand;
|
import com.fpghoti.biscuit.commands.base.ClientCommand;
|
||||||
import com.fpghoti.biscuit.util.PermUtil;
|
import com.fpghoti.biscuit.util.PermUtil;
|
||||||
|
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||||
|
|
||||||
public class GuildIDCommand extends ClientCommand{
|
public class GuildIDCommand extends ClientCommand{
|
||||||
|
|
||||||
|
@ -20,11 +20,11 @@ public class GuildIDCommand extends ClientCommand{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(String[] args, MessageReceivedEvent event) {
|
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||||
b.log(event.getAuthor().getName() + " issued a command: -guildid");
|
b.log(event.getAuthor().getName() + " issued a command: -guildid");
|
||||||
if(PermUtil.isMod(event.getMember())) {
|
if(PermUtil.isMod(event.getMember())) {
|
||||||
event.getTextChannel().sendMessage(event.getGuild().getId()).queue();
|
event.getChannel().sendMessage(event.getGuild().getId()).queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ import com.fpghoti.biscuit.commands.base.CustomCommand;
|
||||||
import com.fpghoti.biscuit.commands.base.MusicClientCommand;
|
import com.fpghoti.biscuit.commands.base.MusicClientCommand;
|
||||||
import com.fpghoti.biscuit.util.Util;
|
import com.fpghoti.biscuit.util.Util;
|
||||||
|
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||||
|
|
||||||
public class HelpCommand extends ClientCommand {
|
public class HelpCommand extends ClientCommand {
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ public class HelpCommand extends ClientCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(String[] args, MessageReceivedEvent event) {
|
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||||
|
|
||||||
Biscuit biscuit = Biscuit.getBiscuit(event.getGuild());
|
Biscuit biscuit = Biscuit.getBiscuit(event.getGuild());
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ public class HelpCommand extends ClientCommand {
|
||||||
if(Util.isDigit(args[0])) {
|
if(Util.isDigit(args[0])) {
|
||||||
pg = Integer.parseInt(args[0]);
|
pg = Integer.parseInt(args[0]);
|
||||||
}else {
|
}else {
|
||||||
event.getTextChannel().sendMessage("Usage: ``" + usage + "``").queue();
|
event.getChannel().sendMessage("Usage: ``" + usage + "``").queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<BaseCommand> commands = new ArrayList<BaseCommand>();
|
List<BaseCommand> commands = new ArrayList<BaseCommand>();
|
||||||
|
@ -72,8 +72,8 @@ public class HelpCommand extends ClientCommand {
|
||||||
pg = pageCount;
|
pg = pageCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
event.getTextChannel().sendMessage("**Use " + Main.getMainBiscuit().getProperties().getCommandSignifier() + "help [Page #] to navigate the different pages.**").queue();
|
event.getChannel().sendMessage("**Use " + Main.getMainBiscuit().getProperties().getCommandSignifier() + "help [Page #] to navigate the different pages.**").queue();
|
||||||
event.getTextChannel().sendMessage("[" + Integer.toString(pg) + "/" + Integer.toString(pageCount) + "] **Bot Commands:**").queue();
|
event.getChannel().sendMessage("[" + Integer.toString(pg) + "/" + Integer.toString(pageCount) + "] **Bot Commands:**").queue();
|
||||||
String msg = "";
|
String msg = "";
|
||||||
for (int i = 0; i < 8; i++) {
|
for (int i = 0; i < 8; i++) {
|
||||||
int index = (pg - 1) * 8 + i;
|
int index = (pg - 1) * 8 + i;
|
||||||
|
@ -88,7 +88,7 @@ public class HelpCommand extends ClientCommand {
|
||||||
msg = msg + line;
|
msg = msg + line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
event.getTextChannel().sendMessage(msg).queue();
|
event.getChannel().sendMessage(msg).queue();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||||
import com.fpghoti.biscuit.commands.base.MusicClientCommand;
|
import com.fpghoti.biscuit.commands.base.MusicClientCommand;
|
||||||
import com.fpghoti.biscuit.util.PermUtil;
|
import com.fpghoti.biscuit.util.PermUtil;
|
||||||
|
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||||
|
|
||||||
public class LoopMusicCommand extends MusicClientCommand{
|
public class LoopMusicCommand extends MusicClientCommand{
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ public class LoopMusicCommand extends MusicClientCommand{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(String[] args, MessageReceivedEvent event) {
|
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||||
b.log(event.getAuthor().getName() + " issued a command: -loopmusic");
|
b.log(event.getAuthor().getName() + " issued a command: -loopmusic");
|
||||||
if(PermUtil.isMod(event.getMember())) {
|
if(PermUtil.isMod(event.getMember())) {
|
||||||
|
|
|
@ -8,7 +8,7 @@ import com.fpghoti.biscuit.util.Util;
|
||||||
|
|
||||||
import net.dv8tion.jda.api.entities.Guild;
|
import net.dv8tion.jda.api.entities.Guild;
|
||||||
import net.dv8tion.jda.api.entities.TextChannel;
|
import net.dv8tion.jda.api.entities.TextChannel;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||||
|
|
||||||
public class MakeInviteCommand extends ClientCommand{
|
public class MakeInviteCommand extends ClientCommand{
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ public class MakeInviteCommand extends ClientCommand{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(String[] args, MessageReceivedEvent event) {
|
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||||
double doubAge = 0;
|
double doubAge = 0;
|
||||||
if(args.length == 2 && Util.isDeciDigit(args[1])) {
|
if(args.length == 2 && Util.isDeciDigit(args[1])) {
|
||||||
doubAge = Double.parseDouble(args[1]) * 3600;
|
doubAge = Double.parseDouble(args[1]) * 3600;
|
||||||
|
|
|
@ -5,7 +5,7 @@ import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||||
import com.fpghoti.biscuit.commands.base.ClientCommand;
|
import com.fpghoti.biscuit.commands.base.ClientCommand;
|
||||||
import com.fpghoti.biscuit.util.Util;
|
import com.fpghoti.biscuit.util.Util;
|
||||||
|
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||||
|
|
||||||
public class MultiplyCommand extends ClientCommand{
|
public class MultiplyCommand extends ClientCommand{
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ public class MultiplyCommand extends ClientCommand{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(String[] args, MessageReceivedEvent event) {
|
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||||
b.log(event.getAuthor().getName() + " issued a command: -multiply");
|
b.log(event.getAuthor().getName() + " issued a command: -multiply");
|
||||||
if(args[0] != null && Util.isDeciDigit(args[0]) && args[1] != null && Util.isDeciDigit(args[1])) {
|
if(args[0] != null && Util.isDeciDigit(args[0]) && args[1] != null && Util.isDeciDigit(args[1])) {
|
||||||
|
@ -31,7 +31,7 @@ public class MultiplyCommand extends ClientCommand{
|
||||||
if(end.equals(".0")) {
|
if(end.equals(".0")) {
|
||||||
prod = prod.replace(".0","");
|
prod = prod.replace(".0","");
|
||||||
}
|
}
|
||||||
event.getTextChannel().sendMessage(args[0] + " x " + args[1] + " is **" + prod + "**.").queue();
|
event.getChannel().sendMessage(args[0] + " x " + args[1] + " is **" + prod + "**.").queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import com.fpghoti.biscuit.util.PermUtil;
|
||||||
|
|
||||||
import net.dv8tion.jda.api.entities.Member;
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
import net.dv8tion.jda.api.entities.User;
|
import net.dv8tion.jda.api.entities.User;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||||
|
|
||||||
public class NotSpammerCommand extends ClientCommand{
|
public class NotSpammerCommand extends ClientCommand{
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ public class NotSpammerCommand extends ClientCommand{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(String[] args, MessageReceivedEvent event) {
|
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||||
b.log(event.getAuthor().getName() + " issued a command: -notspammer " + args[0]);
|
b.log(event.getAuthor().getName() + " issued a command: -notspammer " + args[0]);
|
||||||
for(Member m : event.getMessage().getMentionedMembers()){
|
for(Member m : event.getMessage().getMentionedMembers()){
|
||||||
|
@ -29,7 +29,7 @@ public class NotSpammerCommand extends ClientCommand{
|
||||||
String s = u.getAsMention();
|
String s = u.getAsMention();
|
||||||
if(event.getChannel().getName().equals("public-spam-test") || (PermUtil.isMod(event.getMember()))) {
|
if(event.getChannel().getName().equals("public-spam-test") || (PermUtil.isMod(event.getMember()))) {
|
||||||
b.getMessageStore().removeSpammer(u);
|
b.getMessageStore().removeSpammer(u);
|
||||||
event.getTextChannel().sendMessage(s+ " is no longer flagged as spam.").queue();
|
event.getChannel().sendMessage(s+ " is no longer flagged as spam.").queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,9 @@ package com.fpghoti.biscuit.commands.client;
|
||||||
import com.fpghoti.biscuit.Main;
|
import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||||
import com.fpghoti.biscuit.commands.base.MusicClientCommand;
|
import com.fpghoti.biscuit.commands.base.MusicClientCommand;
|
||||||
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
|
||||||
|
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.entities.MessageEmbed;
|
||||||
|
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||||
|
|
||||||
public class NowPlayingCommand extends MusicClientCommand{
|
public class NowPlayingCommand extends MusicClientCommand{
|
||||||
|
|
||||||
|
@ -19,12 +19,12 @@ public class NowPlayingCommand extends MusicClientCommand{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(String[] args, MessageReceivedEvent event) {
|
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||||
b.log(event.getAuthor().getName() + " issued a command: -nowplaying");
|
b.log(event.getAuthor().getName() + " issued a command: -nowplaying");
|
||||||
if(b.getAudioPlayer().getPlayingTrack() != null) {
|
if(b.getAudioScheduler().getQueue().getLastTrack() != null ) {
|
||||||
AudioTrack track = b.getAudioPlayer().getPlayingTrack();
|
MessageEmbed next = b.getAudioScheduler().getQueue().getLastTrack().getEmbedMessage("Now Playing:", true);
|
||||||
event.getChannel().sendMessage(b.getAudioScheduler().getMessage(track, true)).queue();
|
event.getChannel().sendMessage(next).queue();
|
||||||
}else {
|
}else {
|
||||||
event.getChannel().sendMessage("No song is currently playing.").queue();
|
event.getChannel().sendMessage("No song is currently playing.").queue();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||||
import com.fpghoti.biscuit.commands.base.MusicClientCommand;
|
import com.fpghoti.biscuit.commands.base.MusicClientCommand;
|
||||||
import com.fpghoti.biscuit.util.PermUtil;
|
import com.fpghoti.biscuit.util.PermUtil;
|
||||||
|
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||||
|
|
||||||
public class PauseCommand extends MusicClientCommand{
|
public class PauseCommand extends MusicClientCommand{
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ public class PauseCommand extends MusicClientCommand{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(String[] args, MessageReceivedEvent event) {
|
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||||
b.log(event.getAuthor().getName() + " issued a command: -pause");
|
b.log(event.getAuthor().getName() + " issued a command: -pause");
|
||||||
if(PermUtil.isMod(event.getMember())) {
|
if(PermUtil.isMod(event.getMember())) {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||||
import com.fpghoti.biscuit.commands.base.ClientCommand;
|
import com.fpghoti.biscuit.commands.base.ClientCommand;
|
||||||
|
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||||
|
|
||||||
public class PingCommand extends ClientCommand{
|
public class PingCommand extends ClientCommand{
|
||||||
|
|
||||||
|
@ -18,10 +18,10 @@ public class PingCommand extends ClientCommand{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(String[] args, MessageReceivedEvent event) {
|
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||||
b.log(event.getAuthor().getName() + " issued a command: -ping");
|
b.log(event.getAuthor().getName() + " issued a command: -ping");
|
||||||
event.getTextChannel().sendMessage("Pong!").queue();
|
event.getChannel().sendMessage("Pong!").queue();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager;
|
||||||
import net.dv8tion.jda.api.entities.Guild;
|
import net.dv8tion.jda.api.entities.Guild;
|
||||||
import net.dv8tion.jda.api.entities.TextChannel;
|
import net.dv8tion.jda.api.entities.TextChannel;
|
||||||
import net.dv8tion.jda.api.entities.VoiceChannel;
|
import net.dv8tion.jda.api.entities.VoiceChannel;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||||
import net.dv8tion.jda.api.managers.AudioManager;
|
import net.dv8tion.jda.api.managers.AudioManager;
|
||||||
|
|
||||||
public class PlayCommand extends MusicClientCommand{
|
public class PlayCommand extends MusicClientCommand{
|
||||||
|
@ -25,10 +25,10 @@ public class PlayCommand extends MusicClientCommand{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(String[] args, MessageReceivedEvent event) {
|
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||||
Guild guild = event.getGuild();
|
Guild guild = event.getGuild();
|
||||||
Biscuit b = Biscuit.getBiscuit(guild);
|
Biscuit b = Biscuit.getBiscuit(guild);
|
||||||
TextChannel tchannel = event.getTextChannel();
|
TextChannel tchannel = event.getChannel();
|
||||||
|
|
||||||
String searchPhrase = args[0];
|
String searchPhrase = args[0];
|
||||||
if(args.length > 1) {
|
if(args.length > 1) {
|
||||||
|
@ -75,7 +75,7 @@ public class PlayCommand extends MusicClientCommand{
|
||||||
AudioPlayerManager playerManager = Main.getPlayerManager();
|
AudioPlayerManager playerManager = Main.getPlayerManager();
|
||||||
String vidid = getID(event.getMessage().getContentRaw().split(" ")[1]);
|
String vidid = getID(event.getMessage().getContentRaw().split(" ")[1]);
|
||||||
|
|
||||||
playerManager.loadItemOrdered(guild, vidid, new AudioResultHandler(b,event.getAuthor().getId(), tchannel, false, searchPhrase));
|
playerManager.loadItemOrdered(guild, vidid, new AudioResultHandler(event.getAuthor().getId(), tchannel, false, searchPhrase, false, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getID(String url) {
|
private String getID(String url) {
|
||||||
|
|
|
@ -11,7 +11,7 @@ import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager;
|
||||||
import net.dv8tion.jda.api.entities.Guild;
|
import net.dv8tion.jda.api.entities.Guild;
|
||||||
import net.dv8tion.jda.api.entities.TextChannel;
|
import net.dv8tion.jda.api.entities.TextChannel;
|
||||||
import net.dv8tion.jda.api.entities.VoiceChannel;
|
import net.dv8tion.jda.api.entities.VoiceChannel;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||||
import net.dv8tion.jda.api.managers.AudioManager;
|
import net.dv8tion.jda.api.managers.AudioManager;
|
||||||
|
|
||||||
public class PlayFirstCommand extends MusicClientCommand{
|
public class PlayFirstCommand extends MusicClientCommand{
|
||||||
|
@ -26,10 +26,10 @@ public class PlayFirstCommand extends MusicClientCommand{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(String[] args, MessageReceivedEvent event) {
|
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||||
Guild guild = event.getGuild();
|
Guild guild = event.getGuild();
|
||||||
Biscuit b = Biscuit.getBiscuit(guild);
|
Biscuit b = Biscuit.getBiscuit(guild);
|
||||||
TextChannel tchannel = event.getTextChannel();
|
TextChannel tchannel = event.getChannel();
|
||||||
|
|
||||||
String searchPhrase = args[0];
|
String searchPhrase = args[0];
|
||||||
if(args.length > 1) {
|
if(args.length > 1) {
|
||||||
|
@ -82,7 +82,7 @@ public class PlayFirstCommand extends MusicClientCommand{
|
||||||
AudioPlayerManager playerManager = Main.getPlayerManager();
|
AudioPlayerManager playerManager = Main.getPlayerManager();
|
||||||
String vidid = getID(event.getMessage().getContentRaw().split(" ")[1]);
|
String vidid = getID(event.getMessage().getContentRaw().split(" ")[1]);
|
||||||
|
|
||||||
playerManager.loadItemOrdered(guild, vidid, new AudioResultHandler(b,event.getAuthor().getId(), tchannel, false, searchPhrase, true));
|
playerManager.loadItemOrdered(guild, vidid, new AudioResultHandler(event.getAuthor().getId(), tchannel, false, searchPhrase, true, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getID(String url) {
|
private String getID(String url) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||||
import com.fpghoti.biscuit.commands.base.ClientCommand;
|
import com.fpghoti.biscuit.commands.base.ClientCommand;
|
||||||
import com.fpghoti.biscuit.util.Util;
|
import com.fpghoti.biscuit.util.Util;
|
||||||
|
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||||
|
|
||||||
public class PowerCommand extends ClientCommand{
|
public class PowerCommand extends ClientCommand{
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ public class PowerCommand extends ClientCommand{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(String[] args, MessageReceivedEvent event) {
|
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||||
b.log(event.getAuthor().getName() + " issued a command: -power");
|
b.log(event.getAuthor().getName() + " issued a command: -power");
|
||||||
if(args[0] != null && Util.isDeciDigit(args[0]) && args[1] != null && Util.isDeciDigit(args[1])) {
|
if(args[0] != null && Util.isDeciDigit(args[0]) && args[1] != null && Util.isDeciDigit(args[1])) {
|
||||||
|
@ -31,7 +31,7 @@ public class PowerCommand extends ClientCommand{
|
||||||
if(end.equals(".0")) {
|
if(end.equals(".0")) {
|
||||||
pow = pow.replace(".0","");
|
pow = pow.replace(".0","");
|
||||||
}
|
}
|
||||||
event.getTextChannel().sendMessage(args[0] + "^" + args[1] + " is **" + pow + "**.").queue();
|
event.getChannel().sendMessage(args[0] + "^" + args[1] + " is **" + pow + "**.").queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ import com.fpghoti.biscuit.util.Util;
|
||||||
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
||||||
|
|
||||||
import net.dv8tion.jda.api.entities.Member;
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||||
|
|
||||||
public class QueueCommand extends MusicClientCommand{
|
public class QueueCommand extends MusicClientCommand{
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ public class QueueCommand extends MusicClientCommand{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(String[] args, MessageReceivedEvent event) {
|
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||||
|
|
||||||
Biscuit biscuit = Biscuit.getBiscuit(event.getGuild());
|
Biscuit biscuit = Biscuit.getBiscuit(event.getGuild());
|
||||||
biscuit.log(event.getAuthor().getName() + " issued a command: -queue");
|
biscuit.log(event.getAuthor().getName() + " issued a command: -queue");
|
||||||
|
@ -32,7 +32,7 @@ public class QueueCommand extends MusicClientCommand{
|
||||||
if(Util.isDigit(args[0])) {
|
if(Util.isDigit(args[0])) {
|
||||||
pg = Integer.parseInt(args[0]);
|
pg = Integer.parseInt(args[0]);
|
||||||
}else {
|
}else {
|
||||||
event.getTextChannel().sendMessage("Usage: ``" + usage + "``").queue();
|
event.getChannel().sendMessage("Usage: ``" + usage + "``").queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,15 +45,15 @@ public class QueueCommand extends MusicClientCommand{
|
||||||
|
|
||||||
if(queue.size() == 0) {
|
if(queue.size() == 0) {
|
||||||
if(biscuit.getAudioPlayer().getPlayingTrack() == null) {
|
if(biscuit.getAudioPlayer().getPlayingTrack() == null) {
|
||||||
event.getTextChannel().sendMessage("There is currently no song playing.").queue();
|
event.getChannel().sendMessage("There is currently no song playing.").queue();
|
||||||
}else {
|
}else {
|
||||||
event.getTextChannel().sendMessage("Nothing is queued to play after the current track.").queue();
|
event.getChannel().sendMessage("Nothing is queued to play after the current track.").queue();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
event.getTextChannel().sendMessage("**Use " + Main.getMainBiscuit().getProperties().getCommandSignifier() + "queue [Page #] to navigate the different pages.**").queue();
|
event.getChannel().sendMessage("**Use " + Main.getMainBiscuit().getProperties().getCommandSignifier() + "queue [Page #] to navigate the different pages.**").queue();
|
||||||
event.getTextChannel().sendMessage("[" + Integer.toString(pg) + "/" + Integer.toString(pageCount) + "] ** Upcoming Music Tracks:**").queue();
|
event.getChannel().sendMessage("[" + Integer.toString(pg) + "/" + Integer.toString(pageCount) + "] ** Upcoming Music Tracks:**").queue();
|
||||||
String msg = "";
|
String msg = "";
|
||||||
for (int i = 0; i < 8; i++) {
|
for (int i = 0; i < 8; i++) {
|
||||||
int index = (pg - 1) * 8 + i;
|
int index = (pg - 1) * 8 + i;
|
||||||
|
@ -75,7 +75,7 @@ public class QueueCommand extends MusicClientCommand{
|
||||||
msg = msg + line;
|
msg = msg + line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
event.getTextChannel().sendMessage(msg).queue();
|
event.getChannel().sendMessage(msg).queue();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||||
import com.fpghoti.biscuit.commands.base.ClientCommand;
|
import com.fpghoti.biscuit.commands.base.ClientCommand;
|
||||||
|
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||||
|
|
||||||
public class RecentSpammersCommand extends ClientCommand{
|
public class RecentSpammersCommand extends ClientCommand{
|
||||||
|
|
||||||
|
@ -18,11 +18,11 @@ public class RecentSpammersCommand extends ClientCommand{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(String[] args, MessageReceivedEvent event) {
|
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||||
b.log(event.getAuthor().getName() + " issued a command: -recentspammers");
|
b.log(event.getAuthor().getName() + " issued a command: -recentspammers");
|
||||||
String msg = b.getMessageStore().getSpammerList();
|
String msg = b.getMessageStore().getSpammerList();
|
||||||
event.getTextChannel().sendMessage(msg).queue();
|
event.getChannel().sendMessage(msg).queue();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ import com.fpghoti.biscuit.util.PermUtil;
|
||||||
|
|
||||||
import net.dv8tion.jda.api.entities.Message;
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
import net.dv8tion.jda.api.entities.Message.Attachment;
|
import net.dv8tion.jda.api.entities.Message.Attachment;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||||
|
|
||||||
public class SaveConfigCommand extends ClientCommand{
|
public class SaveConfigCommand extends ClientCommand{
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ public class SaveConfigCommand extends ClientCommand{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(String[] args, MessageReceivedEvent event) {
|
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||||
b.log(event.getAuthor().getName() + " issued a command: -saveconfig");
|
b.log(event.getAuthor().getName() + " issued a command: -saveconfig");
|
||||||
List<Attachment> attch = event.getMessage().getAttachments();
|
List<Attachment> attch = event.getMessage().getAttachments();
|
||||||
|
@ -34,12 +34,12 @@ public class SaveConfigCommand extends ClientCommand{
|
||||||
if(!attch.isEmpty()) {
|
if(!attch.isEmpty()) {
|
||||||
if(attch.size() == 1) {
|
if(attch.size() == 1) {
|
||||||
for(Attachment a : attch) {
|
for(Attachment a : attch) {
|
||||||
b.getConfig().replaceConfig(a, event.getTextChannel());
|
b.getConfig().replaceConfig(a, event.getChannel());
|
||||||
b.remove();
|
b.remove();
|
||||||
b = Biscuit.loadGuild(event.getGuild());
|
b = Biscuit.loadGuild(event.getGuild());
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
event.getTextChannel().sendMessage(event.getAuthor().getAsMention() + " Too many attachments added! "
|
event.getChannel().sendMessage(event.getAuthor().getAsMention() + " Too many attachments added! "
|
||||||
+ "Please only include the config file you want to save.").queue(new Consumer<Message>()
|
+ "Please only include the config file you want to save.").queue(new Consumer<Message>()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
@ -49,7 +49,7 @@ public class SaveConfigCommand extends ClientCommand{
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
event.getTextChannel().sendMessage(event.getAuthor().getAsMention() + " You need to send "
|
event.getChannel().sendMessage(event.getAuthor().getAsMention() + " You need to send "
|
||||||
+ "a file in order to save the config.").queue(new Consumer<Message>()
|
+ "a file in order to save the config.").queue(new Consumer<Message>()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
@ -60,7 +60,7 @@ public class SaveConfigCommand extends ClientCommand{
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
b.log(BColor.MAGENTA_BOLD + event.getAuthor().getName() + " lacks permission to save the config!");
|
b.log(BColor.MAGENTA_BOLD + event.getAuthor().getName() + " lacks permission to save the config!");
|
||||||
event.getTextChannel().sendMessage(event.getAuthor().getAsMention() + " You do not have "
|
event.getChannel().sendMessage(event.getAuthor().getAsMention() + " You do not have "
|
||||||
+ "permission to save the config.").queue(new Consumer<Message>()
|
+ "permission to save the config.").queue(new Consumer<Message>()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -4,7 +4,8 @@ import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||||
import com.fpghoti.biscuit.commands.base.MusicClientCommand;
|
import com.fpghoti.biscuit.commands.base.MusicClientCommand;
|
||||||
|
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.entities.MessageEmbed;
|
||||||
|
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||||
|
|
||||||
public class SkipCommand extends MusicClientCommand{
|
public class SkipCommand extends MusicClientCommand{
|
||||||
|
|
||||||
|
@ -18,7 +19,10 @@ public class SkipCommand extends MusicClientCommand{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(String[] args, MessageReceivedEvent event) {
|
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||||
|
|
||||||
|
//TODO Redo vote skipping. It does not function correctly.
|
||||||
|
|
||||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||||
b.log(event.getAuthor().getName() + " issued a command: -skip");
|
b.log(event.getAuthor().getName() + " issued a command: -skip");
|
||||||
|
|
||||||
|
@ -36,8 +40,9 @@ public class SkipCommand extends MusicClientCommand{
|
||||||
event.getChannel().sendMessage("Skip vote status: **[" + ( b.getAudioScheduler().getVotes() + 1) + "/"
|
event.getChannel().sendMessage("Skip vote status: **[" + ( b.getAudioScheduler().getVotes() + 1) + "/"
|
||||||
+ (event.getGuild().getAudioManager().getConnectedChannel().getMembers().size() - 1) + "]**"
|
+ (event.getGuild().getAudioManager().getConnectedChannel().getMembers().size() - 1) + "]**"
|
||||||
+ "\nSkipping current track.").queue();
|
+ "\nSkipping current track.").queue();
|
||||||
if(b.getAudioScheduler().getNextMessage() != null ) {
|
if(b.getAudioScheduler().getQueue().getNext() != null ) {
|
||||||
event.getChannel().sendMessage(b.getAudioScheduler().getNextMessage()).queue();
|
MessageEmbed next = b.getAudioScheduler().getQueue().getNext().getEmbedMessage("Now Playing:");
|
||||||
|
event.getChannel().sendMessage(next).queue();
|
||||||
}
|
}
|
||||||
b.getAudioScheduler().skip();
|
b.getAudioScheduler().skip();
|
||||||
return;
|
return;
|
||||||
|
@ -54,8 +59,9 @@ public class SkipCommand extends MusicClientCommand{
|
||||||
event.getChannel().sendMessage("Skip vote status: **[" + b.getAudioScheduler().getVotes() + "/"
|
event.getChannel().sendMessage("Skip vote status: **[" + b.getAudioScheduler().getVotes() + "/"
|
||||||
+ event.getGuild().getAudioManager().getConnectedChannel().getMembers().size() + "]**"
|
+ event.getGuild().getAudioManager().getConnectedChannel().getMembers().size() + "]**"
|
||||||
+ "\nSkipping current track.").queue();
|
+ "\nSkipping current track.").queue();
|
||||||
if(b.getAudioScheduler().getNextMessage() != null ) {
|
if(b.getAudioScheduler().getQueue().getNext() != null ) {
|
||||||
event.getChannel().sendMessage(b.getAudioScheduler().getNextMessage()).queue();
|
MessageEmbed next = b.getAudioScheduler().getQueue().getNext().getEmbedMessage("Now Playing:");
|
||||||
|
event.getChannel().sendMessage(next).queue();
|
||||||
}
|
}
|
||||||
b.getAudioScheduler().skip();
|
b.getAudioScheduler().skip();
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ import com.fpghoti.biscuit.util.PermUtil;
|
||||||
import net.dv8tion.jda.api.entities.Member;
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
import net.dv8tion.jda.api.entities.Message;
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
import net.dv8tion.jda.api.entities.User;
|
import net.dv8tion.jda.api.entities.User;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||||
|
|
||||||
public class SoftMuteCommand extends ClientCommand{
|
public class SoftMuteCommand extends ClientCommand{
|
||||||
|
|
||||||
|
@ -25,14 +25,14 @@ public class SoftMuteCommand extends ClientCommand{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(String[] args, MessageReceivedEvent event) {
|
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||||
b.log(event.getAuthor().getName() + " issued a command: -softmute " + args[0]);
|
b.log(event.getAuthor().getName() + " issued a command: -softmute " + args[0]);
|
||||||
for(Member m : event.getMessage().getMentionedMembers()){
|
for(Member m : event.getMessage().getMentionedMembers()){
|
||||||
User u = m.getUser();
|
User u = m.getUser();
|
||||||
String s = u.getAsMention();
|
String s = u.getAsMention();
|
||||||
if(b.getMessageStore().isSoftmuted(u)) {
|
if(b.getMessageStore().isSoftmuted(u)) {
|
||||||
event.getTextChannel().sendMessage(s+ " is already softmuted.").queue(new Consumer<Message>()
|
event.getChannel().sendMessage(s+ " is already softmuted.").queue(new Consumer<Message>()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void accept(Message msg){
|
public void accept(Message msg){
|
||||||
|
@ -44,7 +44,7 @@ public class SoftMuteCommand extends ClientCommand{
|
||||||
if(event.getChannel().getName().equals("public-softmute-test") || (PermUtil.isMod(event.getMember()))) {
|
if(event.getChannel().getName().equals("public-softmute-test") || (PermUtil.isMod(event.getMember()))) {
|
||||||
b.getMessageStore().addSoftmuted(u);
|
b.getMessageStore().addSoftmuted(u);
|
||||||
u.openPrivateChannel().queue();
|
u.openPrivateChannel().queue();
|
||||||
event.getTextChannel().sendMessage(s+ " is now soft-muted. They will now be only able to send one message every two minutes.").queue();
|
event.getChannel().sendMessage(s+ " is now soft-muted. They will now be only able to send one message every two minutes.").queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||||
import com.fpghoti.biscuit.commands.base.ClientCommand;
|
import com.fpghoti.biscuit.commands.base.ClientCommand;
|
||||||
import com.fpghoti.biscuit.util.Util;
|
import com.fpghoti.biscuit.util.Util;
|
||||||
|
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||||
|
|
||||||
public class SquareRootCommand extends ClientCommand{
|
public class SquareRootCommand extends ClientCommand{
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ public class SquareRootCommand extends ClientCommand{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(String[] args, MessageReceivedEvent event) {
|
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||||
b.log(event.getAuthor().getName() + " issued a command: -squareroot");
|
b.log(event.getAuthor().getName() + " issued a command: -squareroot");
|
||||||
if(args[0] != null && Util.isDeciDigit(args[0])) {
|
if(args[0] != null && Util.isDeciDigit(args[0])) {
|
||||||
|
@ -30,7 +30,7 @@ public class SquareRootCommand extends ClientCommand{
|
||||||
if(end.equals(".0")) {
|
if(end.equals(".0")) {
|
||||||
root = root.replace(".0","");
|
root = root.replace(".0","");
|
||||||
}
|
}
|
||||||
event.getTextChannel().sendMessage("The sqaure root of " + args[0] + " is **" + root + "**.").queue();
|
event.getChannel().sendMessage("The sqaure root of " + args[0] + " is **" + root + "**.").queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||||
import com.fpghoti.biscuit.commands.base.ClientCommand;
|
import com.fpghoti.biscuit.commands.base.ClientCommand;
|
||||||
import com.fpghoti.biscuit.util.Util;
|
import com.fpghoti.biscuit.util.Util;
|
||||||
|
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||||
|
|
||||||
public class SubtractCommand extends ClientCommand{
|
public class SubtractCommand extends ClientCommand{
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ public class SubtractCommand extends ClientCommand{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(String[] args, MessageReceivedEvent event) {
|
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||||
b.log(event.getAuthor().getName() + " issued a command: -subtract");
|
b.log(event.getAuthor().getName() + " issued a command: -subtract");
|
||||||
if(args[0] != null && Util.isDeciDigit(args[0]) && args[1] != null && Util.isDeciDigit(args[1])) {
|
if(args[0] != null && Util.isDeciDigit(args[0]) && args[1] != null && Util.isDeciDigit(args[1])) {
|
||||||
|
@ -31,7 +31,7 @@ public class SubtractCommand extends ClientCommand{
|
||||||
if(end.equals(".0")) {
|
if(end.equals(".0")) {
|
||||||
sub = sub.replace(".0","");
|
sub = sub.replace(".0","");
|
||||||
}
|
}
|
||||||
event.getTextChannel().sendMessage(args[0] + " - " + args[1] + " is **" + sub + "**.").queue();
|
event.getChannel().sendMessage(args[0] + " - " + args[1] + " is **" + sub + "**.").queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||||
import com.fpghoti.biscuit.commands.base.MusicClientCommand;
|
import com.fpghoti.biscuit.commands.base.MusicClientCommand;
|
||||||
import com.fpghoti.biscuit.util.PermUtil;
|
import com.fpghoti.biscuit.util.PermUtil;
|
||||||
|
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||||
|
|
||||||
public class TogglePauseCommand extends MusicClientCommand{
|
public class TogglePauseCommand extends MusicClientCommand{
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ public class TogglePauseCommand extends MusicClientCommand{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(String[] args, MessageReceivedEvent event) {
|
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||||
b.log(event.getAuthor().getName() + " issued a command: -togglepause");
|
b.log(event.getAuthor().getName() + " issued a command: -togglepause");
|
||||||
if(PermUtil.isMod(event.getMember())) {
|
if(PermUtil.isMod(event.getMember())) {
|
||||||
|
|
|
@ -7,7 +7,7 @@ import com.fpghoti.biscuit.util.PermUtil;
|
||||||
|
|
||||||
import net.dv8tion.jda.api.entities.Emote;
|
import net.dv8tion.jda.api.entities.Emote;
|
||||||
import net.dv8tion.jda.api.entities.Role;
|
import net.dv8tion.jda.api.entities.Role;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||||
|
|
||||||
public class ToggleRoleCommand extends ClientCommand{
|
public class ToggleRoleCommand extends ClientCommand{
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ public class ToggleRoleCommand extends ClientCommand{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(String[] args, MessageReceivedEvent event) {
|
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||||
if(!event.getAuthor().isBot()) {
|
if(!event.getAuthor().isBot()) {
|
||||||
b.log(event.getAuthor().getName() + " issued a command: -togglerole " + args[0]);
|
b.log(event.getAuthor().getName() + " issued a command: -togglerole " + args[0]);
|
||||||
|
@ -37,7 +37,7 @@ public class ToggleRoleCommand extends ClientCommand{
|
||||||
}
|
}
|
||||||
|
|
||||||
if(rolename.equals("")) {
|
if(rolename.equals("")) {
|
||||||
event.getTextChannel().sendMessage("Sorry! This role either cannot be toggled or does not exist!").queue();
|
event.getChannel().sendMessage("Sorry! This role either cannot be toggled or does not exist!").queue();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import com.fpghoti.biscuit.util.PermUtil;
|
||||||
|
|
||||||
import net.dv8tion.jda.api.entities.Member;
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
import net.dv8tion.jda.api.entities.User;
|
import net.dv8tion.jda.api.entities.User;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||||
|
|
||||||
public class UIDCommand extends ClientCommand{
|
public class UIDCommand extends ClientCommand{
|
||||||
|
|
||||||
|
@ -21,13 +21,13 @@ public class UIDCommand extends ClientCommand{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(String[] args, MessageReceivedEvent event) {
|
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||||
b.log(event.getAuthor().getName() + " issued a command: -uid " + args[0]);
|
b.log(event.getAuthor().getName() + " issued a command: -uid " + args[0]);
|
||||||
for(Member m : event.getMessage().getMentionedMembers()){
|
for(Member m : event.getMessage().getMentionedMembers()){
|
||||||
User u = m.getUser();
|
User u = m.getUser();
|
||||||
if(PermUtil.isMod(event.getMember())) {
|
if(PermUtil.isMod(event.getMember())) {
|
||||||
event.getTextChannel().sendMessage(u.getId()).queue();
|
event.getChannel().sendMessage(u.getId()).queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import com.fpghoti.biscuit.util.PermUtil;
|
||||||
|
|
||||||
import net.dv8tion.jda.api.entities.Member;
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
import net.dv8tion.jda.api.entities.User;
|
import net.dv8tion.jda.api.entities.User;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||||
|
|
||||||
public class UnSoftMuteCommand extends ClientCommand{
|
public class UnSoftMuteCommand extends ClientCommand{
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ public class UnSoftMuteCommand extends ClientCommand{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(String[] args, MessageReceivedEvent event) {
|
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||||
b.log(event.getAuthor().getName() + " issued a command: -unsoftmute " + args[0]);
|
b.log(event.getAuthor().getName() + " issued a command: -unsoftmute " + args[0]);
|
||||||
for(Member m : event.getMessage().getMentionedMembers()){
|
for(Member m : event.getMessage().getMentionedMembers()){
|
||||||
|
@ -29,7 +29,7 @@ public class UnSoftMuteCommand extends ClientCommand{
|
||||||
String s = u.getAsMention();
|
String s = u.getAsMention();
|
||||||
if(event.getChannel().getName().equals("public-softmute-test") || (PermUtil.isMod(event.getMember()))) {
|
if(event.getChannel().getName().equals("public-softmute-test") || (PermUtil.isMod(event.getMember()))) {
|
||||||
b.getMessageStore().removeSoftmuted(u);
|
b.getMessageStore().removeSoftmuted(u);
|
||||||
event.getTextChannel().sendMessage(s+ " is no longer soft-muted.").queue();
|
event.getChannel().sendMessage(s+ " is no longer soft-muted.").queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||||
import com.fpghoti.biscuit.commands.base.ClientCommand;
|
import com.fpghoti.biscuit.commands.base.ClientCommand;
|
||||||
import com.fpghoti.biscuit.util.PermUtil;
|
import com.fpghoti.biscuit.util.PermUtil;
|
||||||
|
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||||
|
|
||||||
public class UnpauseCommand extends ClientCommand{
|
public class UnpauseCommand extends ClientCommand{
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ public class UnpauseCommand extends ClientCommand{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(String[] args, MessageReceivedEvent event) {
|
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||||
b.log(event.getAuthor().getName() + " issued a command: -unpause");
|
b.log(event.getAuthor().getName() + " issued a command: -unpause");
|
||||||
if(PermUtil.isMod(event.getMember())) {
|
if(PermUtil.isMod(event.getMember())) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||||
import com.fpghoti.biscuit.commands.base.ClientCommand;
|
import com.fpghoti.biscuit.commands.base.ClientCommand;
|
||||||
import com.fpghoti.biscuit.util.PermUtil;
|
import com.fpghoti.biscuit.util.PermUtil;
|
||||||
|
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||||
|
|
||||||
public class WikiCommand extends ClientCommand{
|
public class WikiCommand extends ClientCommand{
|
||||||
|
|
||||||
|
@ -19,11 +19,11 @@ public class WikiCommand extends ClientCommand{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(String[] args, MessageReceivedEvent event) {
|
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||||
b.log(event.getAuthor().getName() + " issued a command: -wiki");
|
b.log(event.getAuthor().getName() + " issued a command: -wiki");
|
||||||
if(PermUtil.isMod(event.getMember())) {
|
if(PermUtil.isMod(event.getMember())) {
|
||||||
event.getTextChannel().sendMessage("https://git.fpghoti.com/thmsdy/Biscuit/wiki").queue();
|
event.getChannel().sendMessage("https://git.fpghoti.com/thmsdy/Biscuit/wiki").queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||||
import com.fpghoti.biscuit.commands.base.MusicClientCommand;
|
import com.fpghoti.biscuit.commands.base.MusicClientCommand;
|
||||||
import com.fpghoti.biscuit.util.PermUtil;
|
import com.fpghoti.biscuit.util.PermUtil;
|
||||||
|
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||||
|
|
||||||
public class WipeQueueCommand extends MusicClientCommand{
|
public class WipeQueueCommand extends MusicClientCommand{
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ public class WipeQueueCommand extends MusicClientCommand{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(String[] args, MessageReceivedEvent event) {
|
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||||
b.log(event.getAuthor().getName() + " issued a command: -wipequeue");
|
b.log(event.getAuthor().getName() + " issued a command: -wipequeue");
|
||||||
if(PermUtil.isMod(event.getMember())) {
|
if(PermUtil.isMod(event.getMember())) {
|
||||||
|
|
|
@ -7,9 +7,8 @@ import com.fpghoti.biscuit.commands.CommandManager;
|
||||||
import com.fpghoti.biscuit.logging.BiscuitLog;
|
import com.fpghoti.biscuit.logging.BiscuitLog;
|
||||||
import com.fpghoti.biscuit.util.PermUtil;
|
import com.fpghoti.biscuit.util.PermUtil;
|
||||||
|
|
||||||
import net.dv8tion.jda.api.entities.ChannelType;
|
|
||||||
import net.dv8tion.jda.api.entities.TextChannel;
|
import net.dv8tion.jda.api.entities.TextChannel;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||||
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||||
|
|
||||||
public class CommandListener extends ListenerAdapter implements Runnable {
|
public class CommandListener extends ListenerAdapter implements Runnable {
|
||||||
|
@ -23,16 +22,14 @@ public class CommandListener extends ListenerAdapter implements Runnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMessageReceived(MessageReceivedEvent event){
|
public void onGuildMessageReceived(GuildMessageReceivedEvent event){
|
||||||
if (event.isFromType(ChannelType.TEXT)) {
|
|
||||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||||
if(PermUtil.isAdmin(event.getMember()) || !b.getProperties().restrictCmdChannels() || (b.getProperties().restrictCmdChannels() && isBotChannel(event.getTextChannel()))) {
|
if(PermUtil.isAdmin(event.getMember()) || !b.getProperties().restrictCmdChannels() || (b.getProperties().restrictCmdChannels() && isBotChannel(event.getChannel()))) {
|
||||||
if(!event.getAuthor().isBot() && event.getMessage().getContentDisplay().startsWith(b.getProperties().getCommandSignifier()) && event.getMessage().getAuthor().getId() != event.getJDA().getSelfUser().getId()){
|
if(!event.getAuthor().isBot() && event.getMessage().getContentDisplay().startsWith(b.getProperties().getCommandSignifier()) && event.getMessage().getAuthor().getId() != event.getJDA().getSelfUser().getId()){
|
||||||
CommandManager.parse(event.getMessage().getContentRaw().toLowerCase(), event);
|
CommandManager.parse(event.getMessage().getContentRaw().toLowerCase(), event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isBotChannel(TextChannel c) {
|
private boolean isBotChannel(TextChannel c) {
|
||||||
Biscuit b = Biscuit.getBiscuit(c.getGuild());
|
Biscuit b = Biscuit.getBiscuit(c.getGuild());
|
||||||
|
|
Loading…
Reference in New Issue