Bot will seach for another video if the selected video cannot be played
This commit is contained in:
@@ -12,14 +12,14 @@ import com.fpghoti.biscuit.commands.base.MusicClientCommand;
|
||||
import com.fpghoti.biscuit.util.PermUtil;
|
||||
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 {
|
||||
|
||||
private static List<BaseCommand> commands = new ArrayList<BaseCommand>();
|
||||
|
||||
public static void parse(String message, MessageReceivedEvent e){
|
||||
Biscuit b = Biscuit.getBiscuit(e.getGuild());
|
||||
public static void parse(String message, GuildMessageReceivedEvent event){
|
||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
ArrayList<String> split = new ArrayList<String>();
|
||||
String fixed = message.replaceFirst(b.getProperties().getCommandSignifier(), "");
|
||||
String[] splitMsg = fixed.split(" ");
|
||||
@@ -30,7 +30,7 @@ public class CommandManager {
|
||||
String[] args = new String[split.size() - 1];
|
||||
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);
|
||||
}
|
||||
|
||||
public static boolean dispatch(MessageReceivedEvent e, String label, String[] args) {
|
||||
public static boolean dispatch(GuildMessageReceivedEvent event, String label, String[] args) {
|
||||
Biscuit b = Main.getMainBiscuit();
|
||||
boolean isMain = true;
|
||||
if(e != null) {
|
||||
b = Biscuit.getBiscuit(e.getGuild());
|
||||
if(event != null) {
|
||||
b = Biscuit.getBiscuit(event.getGuild());
|
||||
isMain = false;
|
||||
if(Util.contains(b.getProperties().disabledCommands(), label)) {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -79,17 +79,17 @@ public class CommandManager {
|
||||
}
|
||||
|
||||
if (trimmedArgs == null || (trimmedArgs.length > 0 && trimmedArgs[0].equals("?"))) {
|
||||
commandReply(e, "``Command:" + " " + match.getName() + "``");
|
||||
commandReply(e, "``Description:" + " " + match.getDescription() + "``");
|
||||
commandReply(e, "``Usage:" + " " + match.getUsage() + "``");
|
||||
commandReply(event, "``Command:" + " " + match.getName() + "``");
|
||||
commandReply(event, "``Description:" + " " + match.getDescription() + "``");
|
||||
commandReply(event, "``Usage:" + " " + match.getUsage() + "``");
|
||||
List<String> notes = match.getNotes();
|
||||
for (String note : notes) {
|
||||
commandReply(e, note);
|
||||
commandReply(event, note);
|
||||
}
|
||||
} else {
|
||||
if(match instanceof ClientCommand && e != null) {
|
||||
((ClientCommand)match).execute(trimmedArgs, e);
|
||||
}else if(match instanceof ConsoleCommand && e == null) {
|
||||
if(match instanceof ClientCommand && event != null) {
|
||||
((ClientCommand)match).execute(trimmedArgs, event);
|
||||
}else if(match instanceof ConsoleCommand && event == null) {
|
||||
((ConsoleCommand)match).execute(trimmedArgs);
|
||||
}
|
||||
}
|
||||
@@ -97,29 +97,29 @@ public class CommandManager {
|
||||
if(Util.contains(Main.getMainBiscuit().getProperties().getCustomCmds(), label)) {
|
||||
CustomCommand cc = new CustomCommand(label, Main.getMainBiscuit());
|
||||
if(args.length >= 1) {
|
||||
commandReply(e, "``Command:" + " " + cc.getName() + "``");
|
||||
commandReply(e, "``Description:" + " " + cc.getDescription() + "``");
|
||||
commandReply(e, "``Usage:" + " " + cc.getUsage() + "``");
|
||||
commandReply(event, "``Command:" + " " + cc.getName() + "``");
|
||||
commandReply(event, "``Description:" + " " + cc.getDescription() + "``");
|
||||
commandReply(event, "``Usage:" + " " + cc.getUsage() + "``");
|
||||
}else {
|
||||
commandReply(e, CustomCommand.fixPlaceholders(e, cc.getMessage()));
|
||||
commandReply(event, CustomCommand.fixPlaceholders(event, cc.getMessage()));
|
||||
}
|
||||
}else if(!isMain && Util.contains(b.getProperties().getCustomCmds(), label)) {
|
||||
CustomCommand cc = new CustomCommand(label, b);
|
||||
if(args.length >= 1) {
|
||||
commandReply(e, "``Command:" + " " + cc.getName() + "``");
|
||||
commandReply(e, "``Description:" + " " + cc.getDescription() + "``");
|
||||
commandReply(e, "``Usage:" + " " + cc.getUsage() + "``");
|
||||
commandReply(event, "``Command:" + " " + cc.getName() + "``");
|
||||
commandReply(event, "``Description:" + " " + cc.getDescription() + "``");
|
||||
commandReply(event, "``Usage:" + " " + cc.getUsage() + "``");
|
||||
}else {
|
||||
commandReply(e, CustomCommand.fixPlaceholders(e, cc.getMessage()));
|
||||
commandReply(event, CustomCommand.fixPlaceholders(event, cc.getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void commandReply(MessageReceivedEvent e, String msg) {
|
||||
if(e != null) {
|
||||
e.getTextChannel().sendMessage(msg).queue();
|
||||
public static void commandReply(GuildMessageReceivedEvent event, String msg) {
|
||||
if(event != null) {
|
||||
event.getChannel().sendMessage(msg).queue();
|
||||
}else {
|
||||
Main.getLogger().info(msg);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.fpghoti.biscuit.commands.BaseCommand;
|
||||
import com.fpghoti.biscuit.commands.CommandType;
|
||||
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||
|
||||
public abstract class ClientCommand extends BaseCommand{
|
||||
|
||||
@@ -11,7 +12,7 @@ public abstract class ClientCommand extends BaseCommand{
|
||||
return true;
|
||||
}
|
||||
|
||||
public abstract void execute(String[] args, MessageReceivedEvent event);
|
||||
public abstract void execute(String[] args, GuildMessageReceivedEvent event);
|
||||
|
||||
public CommandType getType() {
|
||||
return CommandType.CLIENT;
|
||||
|
||||
@@ -4,11 +4,11 @@ import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
import com.fpghoti.biscuit.commands.BaseCommand;
|
||||
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 static String fixPlaceholders(MessageReceivedEvent event, String msg) {
|
||||
public static String fixPlaceholders(GuildMessageReceivedEvent event, String msg) {
|
||||
msg = msg.replace("<user>", event.getAuthor().getAsMention());
|
||||
return msg;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
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 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.util.Util;
|
||||
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||
|
||||
public class AddCommand extends ClientCommand{
|
||||
|
||||
@@ -19,7 +19,7 @@ public class AddCommand extends ClientCommand{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -add");
|
||||
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")) {
|
||||
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.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{
|
||||
|
||||
@@ -18,11 +18,11 @@ public class ChanIDCommand extends ClientCommand{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -chanid");
|
||||
String id = event.getTextChannel().getId();
|
||||
event.getTextChannel().sendMessage(id).queue();
|
||||
String id = event.getChannel().getId();
|
||||
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.util.Util;
|
||||
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||
|
||||
public class DivideCommand extends ClientCommand{
|
||||
|
||||
@@ -20,7 +20,7 @@ public class DivideCommand extends ClientCommand{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -divide");
|
||||
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")) {
|
||||
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.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{
|
||||
|
||||
@@ -19,13 +20,14 @@ public class ForceSkipCommand extends MusicClientCommand{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -forceskip");
|
||||
if(PermUtil.isMod(event.getMember())) {
|
||||
event.getChannel().sendMessage("Force skipping current song.").queue();
|
||||
if(b.getAudioScheduler().getNextMessage() != null ) {
|
||||
event.getChannel().sendMessage(b.getAudioScheduler().getNextMessage()).queue();
|
||||
if(b.getAudioScheduler().getQueue().getNext() != null ) {
|
||||
MessageEmbed next = b.getAudioScheduler().getQueue().getNext().getEmbedMessage("Now Playing:");
|
||||
event.getChannel().sendMessage(next).queue();
|
||||
}
|
||||
b.getAudioScheduler().skip();
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.fpghoti.biscuit.logging.BColor;
|
||||
import com.fpghoti.biscuit.util.PermUtil;
|
||||
|
||||
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{
|
||||
|
||||
@@ -24,14 +24,14 @@ public class GetConfigCommand extends ClientCommand{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -getconfig");
|
||||
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 {
|
||||
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>()
|
||||
{
|
||||
@Override
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
import com.fpghoti.biscuit.commands.base.ClientCommand;
|
||||
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{
|
||||
|
||||
@@ -20,11 +20,11 @@ public class GuildIDCommand extends ClientCommand{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -guildid");
|
||||
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.util.Util;
|
||||
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||
|
||||
public class HelpCommand extends ClientCommand {
|
||||
|
||||
@@ -26,7 +26,7 @@ public class HelpCommand extends ClientCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||
|
||||
Biscuit biscuit = Biscuit.getBiscuit(event.getGuild());
|
||||
|
||||
@@ -35,7 +35,7 @@ public class HelpCommand extends ClientCommand {
|
||||
if(Util.isDigit(args[0])) {
|
||||
pg = Integer.parseInt(args[0]);
|
||||
}else {
|
||||
event.getTextChannel().sendMessage("Usage: ``" + usage + "``").queue();
|
||||
event.getChannel().sendMessage("Usage: ``" + usage + "``").queue();
|
||||
}
|
||||
}
|
||||
List<BaseCommand> commands = new ArrayList<BaseCommand>();
|
||||
@@ -72,8 +72,8 @@ public class HelpCommand extends ClientCommand {
|
||||
pg = pageCount;
|
||||
}
|
||||
|
||||
event.getTextChannel().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("**Use " + Main.getMainBiscuit().getProperties().getCommandSignifier() + "help [Page #] to navigate the different pages.**").queue();
|
||||
event.getChannel().sendMessage("[" + Integer.toString(pg) + "/" + Integer.toString(pageCount) + "] **Bot Commands:**").queue();
|
||||
String msg = "";
|
||||
for (int i = 0; i < 8; i++) {
|
||||
int index = (pg - 1) * 8 + i;
|
||||
@@ -88,7 +88,7 @@ public class HelpCommand extends ClientCommand {
|
||||
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.util.PermUtil;
|
||||
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||
|
||||
public class LoopMusicCommand extends MusicClientCommand{
|
||||
|
||||
@@ -19,7 +19,7 @@ public class LoopMusicCommand extends MusicClientCommand{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -loopmusic");
|
||||
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.TextChannel;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||
|
||||
public class MakeInviteCommand extends ClientCommand{
|
||||
|
||||
@@ -22,7 +22,7 @@ public class MakeInviteCommand extends ClientCommand{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||
double doubAge = 0;
|
||||
if(args.length == 2 && Util.isDeciDigit(args[1])) {
|
||||
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.util.Util;
|
||||
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||
|
||||
public class MultiplyCommand extends ClientCommand{
|
||||
|
||||
@@ -20,7 +20,7 @@ public class MultiplyCommand extends ClientCommand{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -multiply");
|
||||
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")) {
|
||||
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.User;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||
|
||||
public class NotSpammerCommand extends ClientCommand{
|
||||
|
||||
@@ -21,7 +21,7 @@ public class NotSpammerCommand extends ClientCommand{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -notspammer " + args[0]);
|
||||
for(Member m : event.getMessage().getMentionedMembers()){
|
||||
@@ -29,7 +29,7 @@ public class NotSpammerCommand extends ClientCommand{
|
||||
String s = u.getAsMention();
|
||||
if(event.getChannel().getName().equals("public-spam-test") || (PermUtil.isMod(event.getMember()))) {
|
||||
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.biscuit.Biscuit;
|
||||
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{
|
||||
|
||||
@@ -19,12 +19,12 @@ public class NowPlayingCommand extends MusicClientCommand{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -nowplaying");
|
||||
if(b.getAudioPlayer().getPlayingTrack() != null) {
|
||||
AudioTrack track = b.getAudioPlayer().getPlayingTrack();
|
||||
event.getChannel().sendMessage(b.getAudioScheduler().getMessage(track, true)).queue();
|
||||
if(b.getAudioScheduler().getQueue().getLastTrack() != null ) {
|
||||
MessageEmbed next = b.getAudioScheduler().getQueue().getLastTrack().getEmbedMessage("Now Playing:", true);
|
||||
event.getChannel().sendMessage(next).queue();
|
||||
}else {
|
||||
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.util.PermUtil;
|
||||
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||
|
||||
public class PauseCommand extends MusicClientCommand{
|
||||
|
||||
@@ -19,7 +19,7 @@ public class PauseCommand extends MusicClientCommand{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -pause");
|
||||
if(PermUtil.isMod(event.getMember())) {
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
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{
|
||||
|
||||
@@ -18,10 +18,10 @@ public class PingCommand extends ClientCommand{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
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.TextChannel;
|
||||
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;
|
||||
|
||||
public class PlayCommand extends MusicClientCommand{
|
||||
@@ -25,10 +25,10 @@ public class PlayCommand extends MusicClientCommand{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||
Guild guild = event.getGuild();
|
||||
Biscuit b = Biscuit.getBiscuit(guild);
|
||||
TextChannel tchannel = event.getTextChannel();
|
||||
TextChannel tchannel = event.getChannel();
|
||||
|
||||
String searchPhrase = args[0];
|
||||
if(args.length > 1) {
|
||||
@@ -75,7 +75,7 @@ public class PlayCommand extends MusicClientCommand{
|
||||
AudioPlayerManager playerManager = Main.getPlayerManager();
|
||||
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) {
|
||||
|
||||
@@ -11,7 +11,7 @@ import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager;
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
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;
|
||||
|
||||
public class PlayFirstCommand extends MusicClientCommand{
|
||||
@@ -26,10 +26,10 @@ public class PlayFirstCommand extends MusicClientCommand{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||
Guild guild = event.getGuild();
|
||||
Biscuit b = Biscuit.getBiscuit(guild);
|
||||
TextChannel tchannel = event.getTextChannel();
|
||||
TextChannel tchannel = event.getChannel();
|
||||
|
||||
String searchPhrase = args[0];
|
||||
if(args.length > 1) {
|
||||
@@ -82,7 +82,7 @@ public class PlayFirstCommand extends MusicClientCommand{
|
||||
AudioPlayerManager playerManager = Main.getPlayerManager();
|
||||
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) {
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
import com.fpghoti.biscuit.commands.base.ClientCommand;
|
||||
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{
|
||||
|
||||
@@ -20,7 +20,7 @@ public class PowerCommand extends ClientCommand{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -power");
|
||||
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")) {
|
||||
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 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{
|
||||
|
||||
@@ -23,7 +23,7 @@ public class QueueCommand extends MusicClientCommand{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||
|
||||
Biscuit biscuit = Biscuit.getBiscuit(event.getGuild());
|
||||
biscuit.log(event.getAuthor().getName() + " issued a command: -queue");
|
||||
@@ -32,7 +32,7 @@ public class QueueCommand extends MusicClientCommand{
|
||||
if(Util.isDigit(args[0])) {
|
||||
pg = Integer.parseInt(args[0]);
|
||||
}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(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 {
|
||||
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;
|
||||
}
|
||||
|
||||
event.getTextChannel().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("**Use " + Main.getMainBiscuit().getProperties().getCommandSignifier() + "queue [Page #] to navigate the different pages.**").queue();
|
||||
event.getChannel().sendMessage("[" + Integer.toString(pg) + "/" + Integer.toString(pageCount) + "] ** Upcoming Music Tracks:**").queue();
|
||||
String msg = "";
|
||||
for (int i = 0; i < 8; i++) {
|
||||
int index = (pg - 1) * 8 + i;
|
||||
@@ -75,7 +75,7 @@ public class QueueCommand extends MusicClientCommand{
|
||||
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.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{
|
||||
|
||||
@@ -18,11 +18,11 @@ public class RecentSpammersCommand extends ClientCommand{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -recentspammers");
|
||||
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.Attachment;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||
|
||||
public class SaveConfigCommand extends ClientCommand{
|
||||
|
||||
@@ -26,7 +26,7 @@ public class SaveConfigCommand extends ClientCommand{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -saveconfig");
|
||||
List<Attachment> attch = event.getMessage().getAttachments();
|
||||
@@ -34,12 +34,12 @@ public class SaveConfigCommand extends ClientCommand{
|
||||
if(!attch.isEmpty()) {
|
||||
if(attch.size() == 1) {
|
||||
for(Attachment a : attch) {
|
||||
b.getConfig().replaceConfig(a, event.getTextChannel());
|
||||
b.getConfig().replaceConfig(a, event.getChannel());
|
||||
b.remove();
|
||||
b = Biscuit.loadGuild(event.getGuild());
|
||||
}
|
||||
}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>()
|
||||
{
|
||||
@Override
|
||||
@@ -49,7 +49,7 @@ public class SaveConfigCommand extends ClientCommand{
|
||||
});
|
||||
}
|
||||
}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>()
|
||||
{
|
||||
@Override
|
||||
@@ -60,7 +60,7 @@ public class SaveConfigCommand extends ClientCommand{
|
||||
}
|
||||
}else {
|
||||
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>()
|
||||
{
|
||||
@Override
|
||||
|
||||
@@ -4,7 +4,8 @@ import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
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{
|
||||
|
||||
@@ -18,7 +19,10 @@ public class SkipCommand extends MusicClientCommand{
|
||||
}
|
||||
|
||||
@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());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -skip");
|
||||
|
||||
@@ -26,7 +30,7 @@ public class SkipCommand extends MusicClientCommand{
|
||||
event.getChannel().sendMessage("There is not a song playing for you to skip!").queue();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(!event.getGuild().getAudioManager().getConnectedChannel().getMembers().contains(event.getMember())) {
|
||||
event.getChannel().sendMessage("You need to be in the same voice channel in order to skip!").queue();
|
||||
return;
|
||||
@@ -36,8 +40,9 @@ public class SkipCommand extends MusicClientCommand{
|
||||
event.getChannel().sendMessage("Skip vote status: **[" + ( b.getAudioScheduler().getVotes() + 1) + "/"
|
||||
+ (event.getGuild().getAudioManager().getConnectedChannel().getMembers().size() - 1) + "]**"
|
||||
+ "\nSkipping current track.").queue();
|
||||
if(b.getAudioScheduler().getNextMessage() != null ) {
|
||||
event.getChannel().sendMessage(b.getAudioScheduler().getNextMessage()).queue();
|
||||
if(b.getAudioScheduler().getQueue().getNext() != null ) {
|
||||
MessageEmbed next = b.getAudioScheduler().getQueue().getNext().getEmbedMessage("Now Playing:");
|
||||
event.getChannel().sendMessage(next).queue();
|
||||
}
|
||||
b.getAudioScheduler().skip();
|
||||
return;
|
||||
@@ -54,8 +59,9 @@ public class SkipCommand extends MusicClientCommand{
|
||||
event.getChannel().sendMessage("Skip vote status: **[" + b.getAudioScheduler().getVotes() + "/"
|
||||
+ event.getGuild().getAudioManager().getConnectedChannel().getMembers().size() + "]**"
|
||||
+ "\nSkipping current track.").queue();
|
||||
if(b.getAudioScheduler().getNextMessage() != null ) {
|
||||
event.getChannel().sendMessage(b.getAudioScheduler().getNextMessage()).queue();
|
||||
if(b.getAudioScheduler().getQueue().getNext() != null ) {
|
||||
MessageEmbed next = b.getAudioScheduler().getQueue().getNext().getEmbedMessage("Now Playing:");
|
||||
event.getChannel().sendMessage(next).queue();
|
||||
}
|
||||
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.Message;
|
||||
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{
|
||||
|
||||
@@ -25,14 +25,14 @@ public class SoftMuteCommand extends ClientCommand{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -softmute " + args[0]);
|
||||
for(Member m : event.getMessage().getMentionedMembers()){
|
||||
User u = m.getUser();
|
||||
String s = u.getAsMention();
|
||||
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
|
||||
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()))) {
|
||||
b.getMessageStore().addSoftmuted(u);
|
||||
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.util.Util;
|
||||
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||
|
||||
public class SquareRootCommand extends ClientCommand{
|
||||
|
||||
@@ -20,7 +20,7 @@ public class SquareRootCommand extends ClientCommand{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -squareroot");
|
||||
if(args[0] != null && Util.isDeciDigit(args[0])) {
|
||||
@@ -30,7 +30,7 @@ public class SquareRootCommand extends ClientCommand{
|
||||
if(end.equals(".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.util.Util;
|
||||
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||
|
||||
public class SubtractCommand extends ClientCommand{
|
||||
|
||||
@@ -20,7 +20,7 @@ public class SubtractCommand extends ClientCommand{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -subtract");
|
||||
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")) {
|
||||
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.util.PermUtil;
|
||||
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||
|
||||
public class TogglePauseCommand extends MusicClientCommand{
|
||||
|
||||
@@ -20,7 +20,7 @@ public class TogglePauseCommand extends MusicClientCommand{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -togglepause");
|
||||
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.Role;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||
|
||||
public class ToggleRoleCommand extends ClientCommand{
|
||||
|
||||
@@ -22,7 +22,7 @@ public class ToggleRoleCommand extends ClientCommand{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
if(!event.getAuthor().isBot()) {
|
||||
b.log(event.getAuthor().getName() + " issued a command: -togglerole " + args[0]);
|
||||
@@ -37,7 +37,7 @@ public class ToggleRoleCommand extends ClientCommand{
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import com.fpghoti.biscuit.util.PermUtil;
|
||||
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
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{
|
||||
|
||||
@@ -21,13 +21,13 @@ public class UIDCommand extends ClientCommand{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -uid " + args[0]);
|
||||
for(Member m : event.getMessage().getMentionedMembers()){
|
||||
User u = m.getUser();
|
||||
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.User;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||
|
||||
public class UnSoftMuteCommand extends ClientCommand{
|
||||
|
||||
@@ -21,7 +21,7 @@ public class UnSoftMuteCommand extends ClientCommand{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -unsoftmute " + args[0]);
|
||||
for(Member m : event.getMessage().getMentionedMembers()){
|
||||
@@ -29,7 +29,7 @@ public class UnSoftMuteCommand extends ClientCommand{
|
||||
String s = u.getAsMention();
|
||||
if(event.getChannel().getName().equals("public-softmute-test") || (PermUtil.isMod(event.getMember()))) {
|
||||
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.util.PermUtil;
|
||||
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||
|
||||
public class UnpauseCommand extends ClientCommand{
|
||||
|
||||
@@ -19,7 +19,7 @@ public class UnpauseCommand extends ClientCommand{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -unpause");
|
||||
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.util.PermUtil;
|
||||
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||
|
||||
public class WikiCommand extends ClientCommand{
|
||||
|
||||
@@ -19,11 +19,11 @@ public class WikiCommand extends ClientCommand{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -wiki");
|
||||
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.util.PermUtil;
|
||||
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||
|
||||
public class WipeQueueCommand extends MusicClientCommand{
|
||||
|
||||
@@ -20,7 +20,7 @@ public class WipeQueueCommand extends MusicClientCommand{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -wipequeue");
|
||||
if(PermUtil.isMod(event.getMember())) {
|
||||
|
||||
Reference in New Issue
Block a user