Update to latest JDA

This commit is contained in:
Ghoti 2022-04-29 18:11:52 -05:00
parent 8d91f00fda
commit 6b16460456
52 changed files with 204 additions and 196 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.fpghoti</groupId>
<artifactId>Biscuit</artifactId>
<version>1.10</version>
<version>1.11</version>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<resources>

View File

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.fpghoti</groupId>
<artifactId>Biscuit</artifactId>
<version>1.10</version>
<version>1.11</version>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<resources>
@ -157,7 +157,7 @@
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>4.3.0_281</version>
<version>5.0.0-alpha.11</version>
</dependency>
<dependency>
<groupId>com.github.cage</groupId>

View File

@ -6,18 +6,21 @@ import com.fpghoti.biscuit.rest.MessageText;
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.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import net.dv8tion.jda.api.managers.AudioManager;
public class PlayCommandUtil {
public static boolean connectToChannel(GuildMessageReceivedEvent event) {
public static boolean connectToChannel(MessageReceivedEvent event) {
if(!event.isFromGuild()) {
return false;
}
Guild guild = event.getGuild();
Biscuit biscuit = Biscuit.getBiscuit(guild);
TextChannel textChannel = event.getChannel();
TextChannel textChannel = event.getTextChannel();
String vcname = "";
if(!event.getMember().getVoiceState().inVoiceChannel()) {
if(!event.getMember().getVoiceState().inAudioChannel()) {
MessageText.send(textChannel, "You must be in a voice channel to do this!");
return false;
}
@ -68,7 +71,7 @@ public class PlayCommandUtil {
return searchPhrase;
}
public static String getID(GuildMessageReceivedEvent event) {
public static String getID(MessageReceivedEvent event) {
return getID(event.getMessage().getContentRaw().split(" ")[1]);
}

View File

@ -13,13 +13,13 @@ import com.fpghoti.biscuit.rest.MessageText;
import com.fpghoti.biscuit.util.PermUtil;
import com.fpghoti.biscuit.util.Util;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class CommandManager {
private static List<BaseCommand> commands = new ArrayList<BaseCommand>();
public static void parse(String message, GuildMessageReceivedEvent event){
public static void parse(String message, MessageReceivedEvent event){
Biscuit b = Biscuit.getBiscuit(event.getGuild());
ArrayList<String> split = new ArrayList<String>();
String fixed = message.replaceFirst(b.getProperties().getCommandSignifier(), "");
@ -39,7 +39,7 @@ public class CommandManager {
return dispatch(null,label,args);
}
public static boolean dispatch(GuildMessageReceivedEvent event, String label, String[] args) {
public static boolean dispatch(MessageReceivedEvent event, String label, String[] args) {
Biscuit b = Main.getMainBiscuit();
boolean isMain = true;
if(event != null) {
@ -118,9 +118,9 @@ public class CommandManager {
return true;
}
public static void commandReply(GuildMessageReceivedEvent event, String msg) {
public static void commandReply(MessageReceivedEvent event, String msg) {
if(event != null) {
MessageText.send(event.getChannel(), msg);
MessageText.send(event.getTextChannel(), msg);
}else {
Main.getLogger().info(msg);
}

View File

@ -4,7 +4,6 @@ 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{
@ -12,7 +11,7 @@ public abstract class ClientCommand extends BaseCommand{
return true;
}
public abstract void execute(String[] args, GuildMessageReceivedEvent event);
public abstract void execute(String[] args, MessageReceivedEvent event);
public CommandType getType() {
return CommandType.CLIENT;

View File

@ -5,11 +5,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.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class CustomCommand extends BaseCommand {
public static String fixPlaceholders(GuildMessageReceivedEvent event, String msg) {
public static String fixPlaceholders(MessageReceivedEvent event, String msg) {
msg = msg.replace("<user>", event.getAuthor().getAsMention());
return msg;
}

View File

@ -1,9 +1,9 @@
package com.fpghoti.biscuit.commands.base;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public abstract class MusicClientCommand extends ClientCommand{
public abstract void execute(String[] args, GuildMessageReceivedEvent event);
public abstract void execute(String[] args, MessageReceivedEvent event);
}

View File

@ -6,7 +6,7 @@ import com.fpghoti.biscuit.commands.base.ClientCommand;
import com.fpghoti.biscuit.rest.MessageText;
import com.fpghoti.biscuit.util.Util;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class AddCommand extends ClientCommand{
@ -20,7 +20,7 @@ public class AddCommand extends ClientCommand{
}
@Override
public void execute(String[] args, GuildMessageReceivedEvent event) {
public void execute(String[] args, MessageReceivedEvent 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])) {
@ -31,7 +31,7 @@ public class AddCommand extends ClientCommand{
if(end.equals(".0")) {
sum = sum.replace(".0","");
}
MessageText.send(event.getChannel(), args[0] + " + " + args[1] + " is **" + sum + "**.");
MessageText.send(event.getTextChannel(), args[0] + " + " + args[1] + " is **" + sum + "**.");
}
}

View File

@ -5,7 +5,7 @@ import com.fpghoti.biscuit.biscuit.Biscuit;
import com.fpghoti.biscuit.commands.base.ClientCommand;
import com.fpghoti.biscuit.rest.MessageText;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class ChanIDCommand extends ClientCommand{
@ -19,11 +19,11 @@ public class ChanIDCommand extends ClientCommand{
}
@Override
public void execute(String[] args, GuildMessageReceivedEvent event) {
public void execute(String[] args, MessageReceivedEvent event) {
Biscuit b = Biscuit.getBiscuit(event.getGuild());
b.log(event.getAuthor().getName() + " issued a command: -chanid");
String id = event.getChannel().getId();
MessageText.send(event.getChannel(), id);
MessageText.send(event.getTextChannel(), id);
}
}

View File

@ -6,7 +6,7 @@ import com.fpghoti.biscuit.commands.base.ClientCommand;
import com.fpghoti.biscuit.rest.MessageText;
import com.fpghoti.biscuit.util.Util;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class DivideCommand extends ClientCommand{
@ -21,7 +21,7 @@ public class DivideCommand extends ClientCommand{
}
@Override
public void execute(String[] args, GuildMessageReceivedEvent event) {
public void execute(String[] args, MessageReceivedEvent 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])) {
@ -32,7 +32,7 @@ public class DivideCommand extends ClientCommand{
if(end.equals(".0")) {
divide = divide.replace(".0","");
}
MessageText.send(event.getChannel(), args[0] + " / " + args[1] + " is **" + divide + "**.");
MessageText.send(event.getTextChannel(), args[0] + " / " + args[1] + " is **" + divide + "**.");
}
}

View File

@ -7,7 +7,7 @@ import com.fpghoti.biscuit.logging.BColor;
import com.fpghoti.biscuit.rest.MessageText;
import com.fpghoti.biscuit.util.PermUtil;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class GetConfigCommand extends ClientCommand{
@ -21,14 +21,14 @@ public class GetConfigCommand extends ClientCommand{
}
@Override
public void execute(String[] args, GuildMessageReceivedEvent event) {
public void execute(String[] args, MessageReceivedEvent event) {
Biscuit b = Biscuit.getBiscuit(event.getGuild());
b.log(event.getAuthor().getName() + " issued a command: -getconfig");
if(PermUtil.isAdmin(event.getMember())) {
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!");
MessageText.sendTimed(event.getChannel(), event.getAuthor().getAsMention() + " You do not have "
MessageText.sendTimed(event.getTextChannel(), event.getAuthor().getAsMention() + " You do not have "
+ "permission to view the config.", 5);
}
}

View File

@ -6,7 +6,7 @@ import com.fpghoti.biscuit.commands.base.ClientCommand;
import com.fpghoti.biscuit.rest.MessageText;
import com.fpghoti.biscuit.util.PermUtil;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class GuildIDCommand extends ClientCommand{
@ -21,11 +21,11 @@ public class GuildIDCommand extends ClientCommand{
}
@Override
public void execute(String[] args, GuildMessageReceivedEvent event) {
public void execute(String[] args, MessageReceivedEvent event) {
Biscuit b = Biscuit.getBiscuit(event.getGuild());
b.log(event.getAuthor().getName() + " issued a command: -guildid");
if(PermUtil.isMod(event.getMember())) {
MessageText.send(event.getChannel(), event.getGuild().getId());
MessageText.send(event.getTextChannel(), event.getGuild().getId());
}
}

View File

@ -13,7 +13,7 @@ import com.fpghoti.biscuit.commands.base.MusicClientCommand;
import com.fpghoti.biscuit.rest.MessageText;
import com.fpghoti.biscuit.util.Util;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class HelpCommand extends ClientCommand {
@ -27,7 +27,7 @@ public class HelpCommand extends ClientCommand {
}
@Override
public void execute(String[] args, GuildMessageReceivedEvent event) {
public void execute(String[] args, MessageReceivedEvent event) {
Biscuit biscuit = Biscuit.getBiscuit(event.getGuild());
@ -36,7 +36,7 @@ public class HelpCommand extends ClientCommand {
if(Util.isDigit(args[0])) {
pg = Integer.parseInt(args[0]);
}else {
MessageText.send(event.getChannel(), "Usage: ``" + usage + "``");
MessageText.send(event.getTextChannel(), "Usage: ``" + usage + "``");
}
}
List<BaseCommand> commands = new ArrayList<BaseCommand>();
@ -66,8 +66,8 @@ public class HelpCommand extends ClientCommand {
pg = pageCount;
}
MessageText.send(event.getChannel(), "**Use " + Main.getMainBiscuit().getProperties().getCommandSignifier() + "help [Page #] to navigate the different pages.**");
MessageText.send(event.getChannel(), "[" + Integer.toString(pg) + "/" + Integer.toString(pageCount) + "] **Bot Commands:**");
MessageText.send(event.getTextChannel(), "**Use " + Main.getMainBiscuit().getProperties().getCommandSignifier() + "help [Page #] to navigate the different pages.**");
MessageText.send(event.getTextChannel(), "[" + Integer.toString(pg) + "/" + Integer.toString(pageCount) + "] **Bot Commands:**");
String msg = "";
for (int i = 0; i < 8; i++) {
int index = (pg - 1) * 8 + i;
@ -82,7 +82,7 @@ public class HelpCommand extends ClientCommand {
msg = msg + line;
}
}
MessageText.send(event.getChannel(), msg);
MessageText.send(event.getTextChannel(), msg);
}
}

View File

@ -9,7 +9,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.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class MakeInviteCommand extends ClientCommand{
@ -23,7 +23,7 @@ public class MakeInviteCommand extends ClientCommand{
}
@Override
public void execute(String[] args, GuildMessageReceivedEvent event) {
public void execute(String[] args, MessageReceivedEvent event) {
double doubAge = 0;
if(args.length == 2 && Util.isDeciDigit(args[1])) {
doubAge = Double.parseDouble(args[1]) * 3600;
@ -40,7 +40,7 @@ public class MakeInviteCommand extends ClientCommand{
}
}
if(doubAge > 86400) {
MessageText.send(event.getChannel(), "That length is longer than what Discord allows. Please try again. (Max 24 hours)");
MessageText.send(event.getTextChannel(), "That length is longer than what Discord allows. Please try again. (Max 24 hours)");
return;
}
final double db = doubAge;
@ -50,7 +50,7 @@ public class MakeInviteCommand extends ClientCommand{
if(db > 0) {
exp = args[1] + " hour(s)";
}
MessageText.send(event.getChannel(), "Created invite **" + i.getCode() + "** Expiration: **" + exp + "**.");
MessageText.send(event.getTextChannel(), "Created invite **" + i.getCode() + "** Expiration: **" + exp + "**.");
});
}
}

View File

@ -6,7 +6,7 @@ import com.fpghoti.biscuit.commands.base.ClientCommand;
import com.fpghoti.biscuit.rest.MessageText;
import com.fpghoti.biscuit.util.Util;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class MultiplyCommand extends ClientCommand{
@ -21,7 +21,7 @@ public class MultiplyCommand extends ClientCommand{
}
@Override
public void execute(String[] args, GuildMessageReceivedEvent event) {
public void execute(String[] args, MessageReceivedEvent 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])) {
@ -32,7 +32,7 @@ public class MultiplyCommand extends ClientCommand{
if(end.equals(".0")) {
prod = prod.replace(".0","");
}
MessageText.send(event.getChannel(), args[0] + " x " + args[1] + " is **" + prod + "**.");
MessageText.send(event.getTextChannel(), args[0] + " x " + args[1] + " is **" + prod + "**.");
}
}

View File

@ -8,7 +8,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.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class NotSpammerCommand extends ClientCommand{
@ -22,7 +22,7 @@ public class NotSpammerCommand extends ClientCommand{
}
@Override
public void execute(String[] args, GuildMessageReceivedEvent event) {
public void execute(String[] args, MessageReceivedEvent event) {
Biscuit b = Biscuit.getBiscuit(event.getGuild());
b.log(event.getAuthor().getName() + " issued a command: -notspammer " + args[0]);
for(Member m : event.getMessage().getMentionedMembers()){
@ -30,7 +30,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);
MessageText.send(event.getChannel(), s + " is no longer flagged as spam.");
MessageText.send(event.getTextChannel(), s + " is no longer flagged as spam.");
}
}
}

View File

@ -5,7 +5,7 @@ import com.fpghoti.biscuit.biscuit.Biscuit;
import com.fpghoti.biscuit.commands.base.ClientCommand;
import com.fpghoti.biscuit.rest.MessageText;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class PingCommand extends ClientCommand{
@ -19,10 +19,10 @@ public class PingCommand extends ClientCommand{
}
@Override
public void execute(String[] args, GuildMessageReceivedEvent event) {
public void execute(String[] args, MessageReceivedEvent event) {
Biscuit b = Biscuit.getBiscuit(event.getGuild());
b.log(event.getAuthor().getName() + " issued a command: -ping");
MessageText.send(event.getChannel(), "Pong!");
MessageText.send(event.getTextChannel(), "Pong!");
}
}

View File

@ -6,7 +6,7 @@ import com.fpghoti.biscuit.commands.base.ClientCommand;
import com.fpghoti.biscuit.rest.MessageText;
import com.fpghoti.biscuit.util.Util;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class PowerCommand extends ClientCommand{
@ -21,7 +21,7 @@ public class PowerCommand extends ClientCommand{
}
@Override
public void execute(String[] args, GuildMessageReceivedEvent event) {
public void execute(String[] args, MessageReceivedEvent 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])) {
@ -32,7 +32,7 @@ public class PowerCommand extends ClientCommand{
if(end.equals(".0")) {
pow = pow.replace(".0","");
}
MessageText.send(event.getChannel(), args[0] + "^" + args[1] + " is **" + pow + "**.");
MessageText.send(event.getTextChannel(), args[0] + "^" + args[1] + " is **" + pow + "**.");
}
}

View File

@ -5,7 +5,7 @@ import com.fpghoti.biscuit.biscuit.Biscuit;
import com.fpghoti.biscuit.commands.base.ClientCommand;
import com.fpghoti.biscuit.rest.MessageText;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class RecentSpammersCommand extends ClientCommand{
@ -19,11 +19,11 @@ public class RecentSpammersCommand extends ClientCommand{
}
@Override
public void execute(String[] args, GuildMessageReceivedEvent event) {
public void execute(String[] args, MessageReceivedEvent event) {
Biscuit b = Biscuit.getBiscuit(event.getGuild());
b.log(event.getAuthor().getName() + " issued a command: -recentspammers");
String msg = b.getMessageStore().getSpammerList();
MessageText.send(event.getChannel(), msg);
MessageText.send(event.getTextChannel(), msg);
}

View File

@ -10,7 +10,7 @@ import com.fpghoti.biscuit.rest.MessageText;
import com.fpghoti.biscuit.util.PermUtil;
import net.dv8tion.jda.api.entities.Message.Attachment;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class SaveConfigCommand extends ClientCommand{
@ -24,7 +24,7 @@ public class SaveConfigCommand extends ClientCommand{
}
@Override
public void execute(String[] args, GuildMessageReceivedEvent event) {
public void execute(String[] args, MessageReceivedEvent event) {
Biscuit b = Biscuit.getBiscuit(event.getGuild());
b.log(event.getAuthor().getName() + " issued a command: -saveconfig");
List<Attachment> attch = event.getMessage().getAttachments();
@ -32,21 +32,21 @@ public class SaveConfigCommand extends ClientCommand{
if(!attch.isEmpty()) {
if(attch.size() == 1) {
for(Attachment a : attch) {
b.getConfig().replaceConfig(a, event.getChannel());
b.getConfig().replaceConfig(a, event.getTextChannel());
b.remove();
b = Biscuit.loadGuild(event.getGuild());
}
}else {
MessageText.sendTimed(event.getChannel(), event.getAuthor().getAsMention() + " Too many attachments added! "
MessageText.sendTimed(event.getTextChannel(), event.getAuthor().getAsMention() + " Too many attachments added! "
+ "Please only include the config file you want to save.", 5);
}
}else {
MessageText.sendTimed(event.getChannel(), event.getAuthor().getAsMention() + " You need to send "
MessageText.sendTimed(event.getTextChannel(), event.getAuthor().getAsMention() + " You need to send "
+ "a file in order to save the config.", 5);
}
}else {
b.log(BColor.MAGENTA_BOLD + event.getAuthor().getName() + " lacks permission to save the config!");
MessageText.sendTimed(event.getChannel(), event.getAuthor().getAsMention() + " You do not have "
MessageText.sendTimed(event.getTextChannel(), event.getAuthor().getAsMention() + " You do not have "
+ "permission to save the config.", 5);
}
}

View File

@ -8,7 +8,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.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class SoftMuteCommand extends ClientCommand{
@ -22,20 +22,20 @@ public class SoftMuteCommand extends ClientCommand{
}
@Override
public void execute(String[] args, GuildMessageReceivedEvent event) {
public void execute(String[] args, MessageReceivedEvent 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)) {
MessageText.sendTimed(event.getChannel(), s + " is already softmuted.", 3);
MessageText.sendTimed(event.getTextChannel(), s + " is already softmuted.", 3);
return;
}
if(event.getChannel().getName().equals("public-softmute-test") || (PermUtil.isMod(event.getMember()))) {
b.getMessageStore().addSoftmuted(u);
u.openPrivateChannel().queue();
MessageText.send(event.getChannel(), s + " is now soft-muted. They will now be only able to send one message every two minutes.");
MessageText.send(event.getTextChannel(), s + " is now soft-muted. They will now be only able to send one message every two minutes.");
}
}
}

View File

@ -6,7 +6,7 @@ import com.fpghoti.biscuit.commands.base.ClientCommand;
import com.fpghoti.biscuit.rest.MessageText;
import com.fpghoti.biscuit.util.Util;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class SquareRootCommand extends ClientCommand{
@ -21,7 +21,7 @@ public class SquareRootCommand extends ClientCommand{
}
@Override
public void execute(String[] args, GuildMessageReceivedEvent event) {
public void execute(String[] args, MessageReceivedEvent event) {
Biscuit b = Biscuit.getBiscuit(event.getGuild());
b.log(event.getAuthor().getName() + " issued a command: -squareroot");
if(args[0] != null && Util.isDeciDigit(args[0])) {
@ -31,7 +31,7 @@ public class SquareRootCommand extends ClientCommand{
if(end.equals(".0")) {
root = root.replace(".0","");
}
MessageText.send(event.getChannel(), "The sqaure root of " + args[0] + " is **" + root + "**.");
MessageText.send(event.getTextChannel(), "The sqaure root of " + args[0] + " is **" + root + "**.");
}
}

View File

@ -6,7 +6,7 @@ import com.fpghoti.biscuit.commands.base.ClientCommand;
import com.fpghoti.biscuit.rest.MessageText;
import com.fpghoti.biscuit.util.Util;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class SubtractCommand extends ClientCommand{
@ -21,7 +21,7 @@ public class SubtractCommand extends ClientCommand{
}
@Override
public void execute(String[] args, GuildMessageReceivedEvent event) {
public void execute(String[] args, MessageReceivedEvent 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])) {
@ -32,7 +32,7 @@ public class SubtractCommand extends ClientCommand{
if(end.equals(".0")) {
sub = sub.replace(".0","");
}
MessageText.send(event.getChannel(), args[0] + " - " + args[1] + " is **" + sub + "**.");
MessageText.send(event.getTextChannel(), args[0] + " - " + args[1] + " is **" + sub + "**.");
}
}

View File

@ -8,7 +8,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.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class ToggleRoleCommand extends ClientCommand{
@ -23,7 +23,7 @@ public class ToggleRoleCommand extends ClientCommand{
}
@Override
public void execute(String[] args, GuildMessageReceivedEvent event) {
public void execute(String[] args, MessageReceivedEvent event) {
Biscuit b = Biscuit.getBiscuit(event.getGuild());
if(!event.getAuthor().isBot()) {
b.log(event.getAuthor().getName() + " issued a command: -togglerole " + args[0]);
@ -38,7 +38,7 @@ public class ToggleRoleCommand extends ClientCommand{
}
if(rolename.equals("")) {
MessageText.send(event.getChannel(), "Sorry! This role either cannot be toggled or does not exist!");
MessageText.send(event.getTextChannel(), "Sorry! This role either cannot be toggled or does not exist!");
return;
}

View File

@ -8,7 +8,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.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class UIDCommand extends ClientCommand{
@ -22,13 +22,13 @@ public class UIDCommand extends ClientCommand{
}
@Override
public void execute(String[] args, GuildMessageReceivedEvent event) {
public void execute(String[] args, MessageReceivedEvent 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())) {
MessageText.send(event.getChannel(), u.getId());
MessageText.send(event.getTextChannel(), u.getId());
}
}
}

View File

@ -8,7 +8,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.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class UnSoftMuteCommand extends ClientCommand{
@ -22,7 +22,7 @@ public class UnSoftMuteCommand extends ClientCommand{
}
@Override
public void execute(String[] args, GuildMessageReceivedEvent event) {
public void execute(String[] args, MessageReceivedEvent event) {
Biscuit b = Biscuit.getBiscuit(event.getGuild());
b.log(event.getAuthor().getName() + " issued a command: -unsoftmute " + args[0]);
for(Member m : event.getMessage().getMentionedMembers()){
@ -30,7 +30,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);
MessageText.send(event.getChannel(), s + " is no longer soft-muted.");
MessageText.send(event.getTextChannel(), s + " is no longer soft-muted.");
}
}
}

View File

@ -6,7 +6,7 @@ import com.fpghoti.biscuit.commands.base.ClientCommand;
import com.fpghoti.biscuit.rest.MessageText;
import com.fpghoti.biscuit.util.PermUtil;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class WikiCommand extends ClientCommand{
@ -20,11 +20,11 @@ public class WikiCommand extends ClientCommand{
}
@Override
public void execute(String[] args, GuildMessageReceivedEvent event) {
public void execute(String[] args, MessageReceivedEvent event) {
Biscuit b = Biscuit.getBiscuit(event.getGuild());
b.log(event.getAuthor().getName() + " issued a command: -wiki");
if(PermUtil.isMod(event.getMember())) {
MessageText.send(event.getChannel(), "https://git.fpghoti.com/thmsdy/Biscuit/wiki");
MessageText.send(event.getTextChannel(), "https://git.fpghoti.com/thmsdy/Biscuit/wiki");
}
}

View File

@ -6,7 +6,7 @@ import com.fpghoti.biscuit.commands.base.MusicClientCommand;
import com.fpghoti.biscuit.rest.MessageText;
import com.fpghoti.biscuit.util.PermUtil;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class ClearCommand extends MusicClientCommand{
@ -20,11 +20,11 @@ public class ClearCommand extends MusicClientCommand{
}
@Override
public void execute(String[] args, GuildMessageReceivedEvent event) {
public void execute(String[] args, MessageReceivedEvent event) {
Biscuit b = Biscuit.getBiscuit(event.getGuild());
b.log(event.getAuthor().getName() + " issued a command: -clear");
if(PermUtil.hasMusicControl(event.getMember())) {
MessageText.send(event.getChannel(), "Cleared all upcoming songs from the queue.");
MessageText.send(event.getTextChannel(), "Cleared all upcoming songs from the queue.");
b.getAudioScheduler().getQueue().clear();
}
}

View File

@ -7,7 +7,7 @@ import com.fpghoti.biscuit.rest.MessageText;
import com.fpghoti.biscuit.util.PermUtil;
import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class ClearUserSongsCommand extends MusicClientCommand{
@ -22,12 +22,12 @@ public class ClearUserSongsCommand extends MusicClientCommand{
}
@Override
public void execute(String[] args, GuildMessageReceivedEvent event) {
public void execute(String[] args, MessageReceivedEvent event) {
Biscuit b = Biscuit.getBiscuit(event.getGuild());
b.log(event.getAuthor().getName() + " issued a command: -clearusersongs " + args[0]);
if(PermUtil.hasMusicControl(event.getMember())) {
for(Member m : event.getMessage().getMentionedMembers()) {
MessageText.send(event.getChannel(), "Clearing all upcoming tracks added by **" + m.getEffectiveName() + "**.");
MessageText.send(event.getTextChannel(), "Clearing all upcoming tracks added by **" + m.getEffectiveName() + "**.");
b.getAudioScheduler().getQueue().removeUserTracks(m.getId());
}
}

View File

@ -6,7 +6,7 @@ import com.fpghoti.biscuit.commands.base.MusicClientCommand;
import com.fpghoti.biscuit.rest.MessageText;
import com.fpghoti.biscuit.util.PermUtil;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class ForceSkipCommand extends MusicClientCommand{
@ -20,12 +20,12 @@ public class ForceSkipCommand extends MusicClientCommand{
}
@Override
public void execute(String[] args, GuildMessageReceivedEvent event) {
public void execute(String[] args, MessageReceivedEvent event) {
Biscuit b = Biscuit.getBiscuit(event.getGuild());
b.log(event.getAuthor().getName() + " issued a command: -forceskip");
if(PermUtil.hasMusicControl(event.getMember())) {
MessageText.send(event.getChannel(), "Force skipping current song.");
b.getAudioScheduler().skip(event.getChannel());
MessageText.send(event.getTextChannel(), "Force skipping current song.");
b.getAudioScheduler().skip(event.getTextChannel());
}
}

View File

@ -7,7 +7,7 @@ import com.fpghoti.biscuit.rest.MessageText;
import com.fpghoti.biscuit.util.PermUtil;
import com.fpghoti.biscuit.util.Util;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class ForceSkipToCommand extends MusicClientCommand{
@ -22,15 +22,15 @@ public class ForceSkipToCommand extends MusicClientCommand{
}
@Override
public void execute(String[] args, GuildMessageReceivedEvent event) {
public void execute(String[] args, MessageReceivedEvent event) {
Biscuit b = Biscuit.getBiscuit(event.getGuild());
b.log(event.getAuthor().getName() + " issued a command: -forceskipto " + args[0]);
if(PermUtil.hasMusicControl(event.getMember())) {
if(Util.isDigit(args[0])) {
int place = Integer.parseInt(args[0]);
MessageText.send(event.getChannel(), "Force skipping to queue position **" + place + "**.");
MessageText.send(event.getTextChannel(), "Force skipping to queue position **" + place + "**.");
b.getAudioScheduler().getQueue().removeTracksBefore(place);
b.getAudioScheduler().skip(event.getChannel());
b.getAudioScheduler().skip(event.getTextChannel());
}
}
}

View File

@ -6,7 +6,7 @@ import com.fpghoti.biscuit.commands.base.MusicClientCommand;
import com.fpghoti.biscuit.rest.MessageText;
import com.fpghoti.biscuit.util.PermUtil;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class LoopMusicCommand extends MusicClientCommand{
@ -20,15 +20,15 @@ public class LoopMusicCommand extends MusicClientCommand{
}
@Override
public void execute(String[] args, GuildMessageReceivedEvent event) {
public void execute(String[] args, MessageReceivedEvent event) {
Biscuit b = Biscuit.getBiscuit(event.getGuild());
b.log(event.getAuthor().getName() + " issued a command: -loopmusic");
if(PermUtil.hasMusicControl(event.getMember())) {
if(!b.getAudioScheduler().isLooping()) {
MessageText.send(event.getChannel(), "Setting all music to loop.");
MessageText.send(event.getTextChannel(), "Setting all music to loop.");
b.getAudioScheduler().setLooping(true);
}else {
MessageText.send(event.getChannel(), "Disabling music looping.");
MessageText.send(event.getTextChannel(), "Disabling music looping.");
b.getAudioScheduler().setLooping(false);
}

View File

@ -7,7 +7,7 @@ import com.fpghoti.biscuit.rest.MessageText;
import com.fpghoti.biscuit.util.PermUtil;
import com.fpghoti.biscuit.util.Util;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class MoveToCommand extends MusicClientCommand{
@ -21,14 +21,14 @@ public class MoveToCommand extends MusicClientCommand{
}
@Override
public void execute(String[] args, GuildMessageReceivedEvent event) {
public void execute(String[] args, MessageReceivedEvent event) {
Biscuit b = Biscuit.getBiscuit(event.getGuild());
b.log(event.getAuthor().getName() + " issued a command: -moveto " + args[0] + " " + args[1]);
if(PermUtil.hasMusicControl(event.getMember())) {
if(Util.isDigit(args[0]) && Util.isDigit(args[1])) {
int oldPlace = Integer.parseInt(args[0]);
int newPlace = Integer.parseInt(args[1]);
MessageText.send(event.getChannel(), "The specified track was moved." );
MessageText.send(event.getTextChannel(), "The specified track was moved." );
b.getAudioScheduler().getQueue().moveToPlace(oldPlace, newPlace);
}
}

View File

@ -6,7 +6,7 @@ import com.fpghoti.biscuit.commands.base.MusicClientCommand;
import com.fpghoti.biscuit.rest.MessageText;
import net.dv8tion.jda.api.entities.MessageEmbed;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class NowPlayingCommand extends MusicClientCommand{
@ -20,14 +20,14 @@ public class NowPlayingCommand extends MusicClientCommand{
}
@Override
public void execute(String[] args, GuildMessageReceivedEvent event) {
public void execute(String[] args, MessageReceivedEvent event) {
Biscuit b = Biscuit.getBiscuit(event.getGuild());
b.log(event.getAuthor().getName() + " issued a command: -nowplaying");
if(b.getAudioScheduler().getQueue().getLastTrack() != null ) {
MessageEmbed next = b.getAudioScheduler().getQueue().getLastTrack().getEmbedMessage("Now Playing:", true);
MessageText.send(event.getChannel(), next);
MessageText.send(event.getTextChannel(), next);
}else {
MessageText.send(event.getChannel(), "No song is currently playing.");
MessageText.send(event.getTextChannel(), "No song is currently playing.");
}
}

View File

@ -6,7 +6,7 @@ import com.fpghoti.biscuit.commands.base.MusicClientCommand;
import com.fpghoti.biscuit.rest.MessageText;
import com.fpghoti.biscuit.util.PermUtil;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class PauseCommand extends MusicClientCommand{
@ -20,15 +20,15 @@ public class PauseCommand extends MusicClientCommand{
}
@Override
public void execute(String[] args, GuildMessageReceivedEvent event) {
public void execute(String[] args, MessageReceivedEvent event) {
Biscuit b = Biscuit.getBiscuit(event.getGuild());
b.log(event.getAuthor().getName() + " issued a command: -pause");
if(PermUtil.hasMusicControl(event.getMember())) {
if(!b.getAudioPlayer().isPaused()) {
b.getAudioPlayer().setPaused(true);
MessageText.send(event.getChannel(), "Paused the current track.");
MessageText.send(event.getTextChannel(), "Paused the current track.");
}else {
MessageText.send(event.getChannel(), "The music player is already paused.");
MessageText.send(event.getTextChannel(), "The music player is already paused.");
}
}
}

View File

@ -13,7 +13,7 @@ import com.fpghoti.biscuit.biscuit.Biscuit;
import com.fpghoti.biscuit.commands.base.MusicClientCommand;
import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class PlayCommand extends MusicClientCommand{
@ -27,7 +27,7 @@ public class PlayCommand extends MusicClientCommand{
}
@Override
public void execute(String[] args, GuildMessageReceivedEvent event) {
public void execute(String[] args, MessageReceivedEvent event) {
Guild guild = event.getGuild();
Biscuit b = Biscuit.getBiscuit(guild);

View File

@ -16,7 +16,7 @@ import com.fpghoti.biscuit.util.PermUtil;
import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.entities.TextChannel;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class PlayFirstCommand extends MusicClientCommand{
@ -30,10 +30,10 @@ public class PlayFirstCommand extends MusicClientCommand{
}
@Override
public void execute(String[] args, GuildMessageReceivedEvent event) {
public void execute(String[] args, MessageReceivedEvent event) {
Guild guild = event.getGuild();
Biscuit b = Biscuit.getBiscuit(guild);
TextChannel tchannel = event.getChannel();
TextChannel tchannel = event.getTextChannel();