Update to latest JDA
This commit is contained in:
parent
8d91f00fda
commit
6b16460456
|
@ -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>
|
||||
|
|
4
pom.xml
4
pom.xml
|
@ -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>
|
||||
|
|
|
@ -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]);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
|
|
@ -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 + "**.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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 + "**.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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 + "**.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 + "**.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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!");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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 + "**.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 + "**.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 + "**.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
int searchArg = 0;
|
||||
boolean scSearch = false;
|
||||
|
|
|
@ -10,7 +10,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.guild.GuildMessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
|
||||
public class QueueCommand extends MusicClientCommand{
|
||||
|
||||
|
@ -24,7 +24,7 @@ public class QueueCommand extends MusicClientCommand{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
|
||||
Biscuit biscuit = Biscuit.getBiscuit(event.getGuild());
|
||||
biscuit.log(event.getAuthor().getName() + " issued a command: -queue");
|
||||
|
@ -33,7 +33,7 @@ public class QueueCommand extends MusicClientCommand{
|
|||
if(Util.isDigit(args[0])) {
|
||||
pg = Integer.parseInt(args[0]);
|
||||
}else {
|
||||
MessageText.send(event.getChannel(), "Usage: ``" + usage + "``");
|
||||
MessageText.send(event.getTextChannel(), "Usage: ``" + usage + "``");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,15 +46,15 @@ public class QueueCommand extends MusicClientCommand{
|
|||
|
||||
if(queue.size() == 0) {
|
||||
if(biscuit.getAudioPlayer().getPlayingTrack() == null) {
|
||||
MessageText.send(event.getChannel(), "There is currently no song playing.");
|
||||
MessageText.send(event.getTextChannel(), "There is currently no song playing.");
|
||||
}else {
|
||||
MessageText.send(event.getChannel(), "Nothing is queued to play after the current track.");
|
||||
MessageText.send(event.getTextChannel(), "Nothing is queued to play after the current track.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
MessageText.send(event.getChannel(), "**Use " + Main.getMainBiscuit().getProperties().getCommandSignifier() + "queue [Page #] to navigate the different pages.**");
|
||||
MessageText.send(event.getChannel(), "[" + Integer.toString(pg) + "/" + Integer.toString(pageCount) + "] ** Upcoming Music Tracks:**");
|
||||
MessageText.send(event.getTextChannel(), "**Use " + Main.getMainBiscuit().getProperties().getCommandSignifier() + "queue [Page #] to navigate the different pages.**");
|
||||
MessageText.send(event.getTextChannel(), "[" + Integer.toString(pg) + "/" + Integer.toString(pageCount) + "] ** Upcoming Music Tracks:**");
|
||||
String msg = "";
|
||||
for (int i = 0; i < 8; i++) {
|
||||
int index = (pg - 1) * 8 + i;
|
||||
|
@ -76,7 +76,7 @@ public class QueueCommand extends MusicClientCommand{
|
|||
msg = msg + line;
|
||||
}
|
||||
}
|
||||
MessageText.send(event.getChannel(), msg);
|
||||
MessageText.send(event.getTextChannel(), msg);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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 RemoveCommand extends MusicClientCommand{
|
||||
|
||||
|
@ -21,13 +21,13 @@ public class RemoveCommand 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: -remove " + args[0]);
|
||||
if(PermUtil.hasMusicControl(event.getMember())) {
|
||||
if(Util.isDigit(args[0])) {
|
||||
int place = Integer.parseInt(args[0]);
|
||||
MessageText.send(event.getChannel(), "Removing track at position **" + place + "**.");
|
||||
MessageText.send(event.getTextChannel(), "Removing track at position **" + place + "**.");
|
||||
b.getAudioScheduler().getQueue().removeTrack(place);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.fpghoti.biscuit.biscuit.Biscuit;
|
|||
import com.fpghoti.biscuit.commands.base.MusicClientCommand;
|
||||
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 ShuffleCommand extends MusicClientCommand{
|
||||
|
||||
|
@ -19,14 +19,14 @@ public class ShuffleCommand 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: -shuffle");
|
||||
if(b.getAudioScheduler().getQueue().getLastTrack() != null ) {
|
||||
b.getAudioScheduler().getQueue().shuffleUserTracks(event.getAuthor().getId());
|
||||
MessageText.send(event.getChannel(), "All songs that you have added to the queue have been shuffled.");
|
||||
MessageText.send(event.getTextChannel(), "All songs that you have added to the queue have been shuffled.");
|
||||
}else {
|
||||
MessageText.send(event.getChannel(), "No song is currently playing.");
|
||||
MessageText.send(event.getTextChannel(), "No song is currently playing.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 SkipAllCommand extends MusicClientCommand{
|
||||
|
||||
|
@ -20,13 +20,13 @@ public class SkipAllCommand 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: -skipall");
|
||||
if(PermUtil.hasMusicControl(event.getMember())) {
|
||||
MessageText.send(event.getChannel(), "Force skipping all songs.");
|
||||
MessageText.send(event.getTextChannel(), "Force skipping all songs.");
|
||||
b.getAudioScheduler().getQueue().clear();
|
||||
b.getAudioScheduler().skip(event.getChannel());
|
||||
b.getAudioScheduler().skip(event.getTextChannel());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,11 +8,11 @@ import com.fpghoti.biscuit.biscuit.Biscuit;
|
|||
import com.fpghoti.biscuit.commands.base.MusicClientCommand;
|
||||
import com.fpghoti.biscuit.rest.MessageText;
|
||||
|
||||
import net.dv8tion.jda.api.entities.AudioChannel;
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
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;
|
||||
|
||||
public class SkipCommand extends MusicClientCommand{
|
||||
|
||||
|
@ -26,21 +26,21 @@ public class SkipCommand extends MusicClientCommand{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
|
||||
Guild guild = event.getGuild();
|
||||
Biscuit biscuit = Biscuit.getBiscuit(guild);
|
||||
biscuit.log(event.getAuthor().getName() + " issued a command: -skip");
|
||||
|
||||
TextChannel cmdChannel = event.getChannel();
|
||||
TextChannel cmdChannel = event.getTextChannel();
|
||||
|
||||
//Bot is not connected to voice channel. Do nothing.
|
||||
if(!guild.getAudioManager().isConnected()) {
|
||||
MessageText.send(event.getChannel(), "The music player is not connected to a voice channel!");
|
||||
MessageText.send(event.getTextChannel(), "The music player is not connected to a voice channel!");
|
||||
return;
|
||||
}
|
||||
|
||||
VoiceChannel voice = guild.getAudioManager().getConnectedChannel();
|
||||
AudioChannel voice = guild.getAudioManager().getConnectedChannel();
|
||||
|
||||
//Bot is connected to a voice channel in the guild, and the command sender is not in the channel.
|
||||
//Do nothing
|
||||
|
@ -112,7 +112,7 @@ public class SkipCommand extends MusicClientCommand{
|
|||
|
||||
}
|
||||
|
||||
private int nonBotCount(VoiceChannel c) {
|
||||
private int nonBotCount(AudioChannel c) {
|
||||
int count = 0;
|
||||
ArrayList<Member> members = new ArrayList<Member>(c.getMembers());
|
||||
for(Member m : members) {
|
||||
|
|
|
@ -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 TogglePauseCommand extends MusicClientCommand{
|
||||
|
||||
|
@ -21,16 +21,16 @@ public class TogglePauseCommand 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: -togglepause");
|
||||
if(PermUtil.hasMusicControl(event.getMember())) {
|
||||
if(b.getAudioPlayer().isPaused()) {
|
||||
b.getAudioPlayer().setPaused(false);
|
||||
MessageText.send(event.getChannel(), "Unpaused the current track.");
|
||||
MessageText.send(event.getTextChannel(), "Unpaused the current track.");
|
||||
}else {
|
||||
b.getAudioPlayer().setPaused(true);
|
||||
MessageText.send(event.getChannel(), "Paused the current track.");
|
||||
MessageText.send(event.getTextChannel(), "Paused the current track.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 UnpauseCommand extends MusicClientCommand{
|
||||
|
||||
|
@ -21,15 +21,15 @@ public class UnpauseCommand 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: -unpause");
|
||||
if(PermUtil.hasMusicControl(event.getMember())) {
|
||||
if(b.getAudioPlayer().isPaused()) {
|
||||
b.getAudioPlayer().setPaused(false);
|
||||
MessageText.send(event.getChannel(), "Unpaused the current track.");
|
||||
MessageText.send(event.getTextChannel(), "Unpaused the current track.");
|
||||
}else {
|
||||
MessageText.send(event.getChannel(), "The music player is not paused.");
|
||||
MessageText.send(event.getTextChannel(), "The music player is not paused.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 VolumeCommand extends MusicClientCommand{
|
||||
|
||||
|
@ -22,12 +22,12 @@ public class VolumeCommand extends MusicClientCommand{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] args, GuildMessageReceivedEvent event) {
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
|
||||
if(args.length < 1) {
|
||||
b.log(event.getAuthor().getName() + " issued a command: -volume");
|
||||
MessageText.send(event.getChannel(), "The current volume is: **" + b.getAudioPlayer().getVolume() + "**.");
|
||||
MessageText.send(event.getTextChannel(), "The current volume is: **" + b.getAudioPlayer().getVolume() + "**.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ public class VolumeCommand extends MusicClientCommand{
|
|||
vol = 150;
|
||||
}
|
||||
b.getAudioPlayer().setVolume(vol);
|
||||
MessageText.send(event.getChannel(), "The volume was set to **" + b.getAudioPlayer().getVolume() + "**.");
|
||||
MessageText.send(event.getTextChannel(), "The volume was set to **" + b.getAudioPlayer().getVolume() + "**.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.fpghoti.biscuit.logging.BiscuitLog;
|
|||
import com.fpghoti.biscuit.util.PermUtil;
|
||||
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||
|
||||
public class CommandListener extends ListenerAdapter implements Runnable {
|
||||
|
@ -22,13 +22,16 @@ public class CommandListener extends ListenerAdapter implements Runnable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onGuildMessageReceived(GuildMessageReceivedEvent event){
|
||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
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()){
|
||||
CommandManager.parse(event.getMessage().getContentRaw().toLowerCase(), event);
|
||||
}
|
||||
public void onMessageReceived(MessageReceivedEvent event){
|
||||
if(!event.isFromGuild()) {
|
||||
return;
|
||||
}
|
||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
if(PermUtil.isAdmin(event.getMember()) || !b.getProperties().restrictCmdChannels() || (b.getProperties().restrictCmdChannels() && isBotChannel(event.getTextChannel()))) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isBotChannel(TextChannel c) {
|
||||
|
|
|
@ -1,22 +1,20 @@
|
|||
package com.fpghoti.biscuit.listener;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.captcha.Captcha;
|
||||
import com.fpghoti.biscuit.captcha.HandleCaptcha;
|
||||
import com.fpghoti.biscuit.logging.BColor;
|
||||
import com.fpghoti.biscuit.user.CaptchaUser;
|
||||
import com.fpghoti.biscuit.util.PermUtil;
|
||||
|
||||
import net.dv8tion.jda.api.JDA;
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.events.message.priv.PrivateMessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.entities.ChannelType;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||
|
||||
public class DMListener extends ListenerAdapter{
|
||||
|
||||
@Override
|
||||
public void onPrivateMessageReceived(PrivateMessageReceivedEvent event){
|
||||
public void onMessageReceived(MessageReceivedEvent event){
|
||||
if(event.getChannelType() != ChannelType.PRIVATE) {
|
||||
return;
|
||||
}
|
||||
if (!event.getAuthor().isBot()) {
|
||||
|
||||
//Log DM content to console
|
||||
|
|
|
@ -9,7 +9,7 @@ import com.fpghoti.biscuit.util.ChatFilter;
|
|||
import com.fpghoti.biscuit.util.PermUtil;
|
||||
import com.fpghoti.biscuit.util.Util;
|
||||
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;
|
||||
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||
|
||||
public class MessageReceiveListener extends ListenerAdapter{
|
||||
|
@ -20,7 +20,10 @@ public class MessageReceiveListener extends ListenerAdapter{
|
|||
*/
|
||||
|
||||
@Override
|
||||
public void onGuildMessageReceived(GuildMessageReceivedEvent event){
|
||||
public void onMessageReceived(MessageReceivedEvent event){
|
||||
if(!event.isFromGuild()) {
|
||||
return;
|
||||
}
|
||||
Biscuit biscuit = Biscuit.getBiscuit(event.getGuild());
|
||||
if(event.getAuthor().isBot()) {
|
||||
logBot(event, biscuit);
|
||||
|
@ -39,14 +42,14 @@ public class MessageReceiveListener extends ListenerAdapter{
|
|||
}
|
||||
|
||||
//Channel is a captcha channel
|
||||
if(HandleCaptcha.isCaptchaChannel(event.getChannel())) {
|
||||
if(HandleCaptcha.isCaptchaChannel(event.getTextChannel())) {
|
||||
HandleCaptcha.handleCaptcha(event.getAuthor(), event.getChannel(), event.getMessage().getContentDisplay());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void logBot(GuildMessageReceivedEvent event, Biscuit biscuit) {
|
||||
if(Util.isLoggable(event.getChannel())) {
|
||||
private void logBot(MessageReceivedEvent event, Biscuit biscuit) {
|
||||
if(Util.isLoggable(event.getTextChannel())) {
|
||||
if(biscuit.getProperties().logChat()) {
|
||||
biscuit.log("[" + BColor.BLACK_BOLD + "BOT" + BColor.RESET + "] [" + BColor.RED + "#" + event.getChannel().getName() + BColor.RESET + "] "
|
||||
+ BColor.RED_BOLD + event.getAuthor().getName() + ": " + BColor.RESET + event.getMessage().getContentDisplay());
|
||||
|
@ -54,8 +57,8 @@ public class MessageReceiveListener extends ListenerAdapter{
|
|||
}
|
||||
}
|
||||
|
||||
private void logUser(GuildMessageReceivedEvent event, Biscuit biscuit) {
|
||||
if(Util.isLoggable(event.getChannel())) {
|
||||
private void logUser(MessageReceivedEvent event, Biscuit biscuit) {
|
||||
if(Util.isLoggable(event.getTextChannel())) {
|
||||
if(biscuit.getProperties().logChat()) {
|
||||
biscuit.log("[" + BColor.CYAN_BOLD + "MSG" + BColor.RESET + "] " + BColor.GREEN + "ID: " + BColor.RESET +
|
||||
event.getMessageId() + BColor.GREEN + " Sender: " + BColor.RESET + event.getAuthor().getAsMention());
|
||||
|
@ -77,17 +80,17 @@ public class MessageReceiveListener extends ListenerAdapter{
|
|||
}
|
||||
}
|
||||
|
||||
private boolean isNaughty(GuildMessageReceivedEvent event) {
|
||||
private boolean isNaughty(MessageReceivedEvent event) {
|
||||
// TODO make staff filter configurable
|
||||
if(!event.getChannel().getName().toLowerCase().contains("staff") && ChatFilter.filter(event, false)){
|
||||
MessageText.sendTimed(event.getChannel(), event.getAuthor().getAsMention() + " This message contains words not appropriate for this channel.", 3);
|
||||
MessageText.sendTimed(event.getTextChannel(), event.getAuthor().getAsMention() + " This message contains words not appropriate for this channel.", 3);
|
||||
event.getMessage().delete().submit();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean handleSpammer(GuildMessageReceivedEvent event, Biscuit biscuit) {
|
||||
private boolean handleSpammer(MessageReceivedEvent event, Biscuit biscuit) {
|
||||
//TODO make numbers configurable
|
||||
BiscuitMessageStore store = biscuit.getMessageStore();
|
||||
String mention = event.getAuthor().getAsMention();
|
||||
|
@ -109,7 +112,7 @@ public class MessageReceiveListener extends ListenerAdapter{
|
|||
return false;
|
||||
}
|
||||
|
||||
private boolean handleSoftmuted(GuildMessageReceivedEvent event, Biscuit biscuit) {
|
||||
private boolean handleSoftmuted(MessageReceivedEvent event, Biscuit biscuit) {
|
||||
//TODO make numbers configurable
|
||||
BiscuitMessageStore store = biscuit.getMessageStore();
|
||||
String mention = event.getAuthor().getAsMention();
|
||||
|
@ -131,7 +134,7 @@ public class MessageReceiveListener extends ListenerAdapter{
|
|||
return false;
|
||||
}
|
||||
|
||||
private void checkNewSpammer(GuildMessageReceivedEvent event, Biscuit biscuit) {
|
||||
private void checkNewSpammer(MessageReceivedEvent event, Biscuit biscuit) {
|
||||
BiscuitMessageStore store = biscuit.getMessageStore();
|
||||
String mention = event.getAuthor().getAsMention();
|
||||
|
||||
|
@ -148,14 +151,14 @@ public class MessageReceiveListener extends ListenerAdapter{
|
|||
store.addSpammer(event.getAuthor());
|
||||
store.removeSpamWarned(event.getAuthor());
|
||||
event.getMessage().delete().submit();
|
||||
MessageText.sendTimed(event.getChannel(), "*Flagging " + mention + " as spam!*", 3);
|
||||
MessageText.sendTimed(event.getTextChannel(), "*Flagging " + mention + " as spam!*", 3);
|
||||
biscuit.log(BColor.MAGENTA_BOLD + "User " + event.getAuthor().getName() + " has been flagged as spam!");
|
||||
event.getMessage().delete().reason("Spam removal activated for " + mention).submit();
|
||||
//User is spamming and has not been warned. Apply warning.
|
||||
}else if(!store.isSpammer(event.getAuthor()) && !store.isSpamWarned(event.getAuthor())){
|
||||
store.removeMessageCount(event.getAuthor());
|
||||
store.addSpamWarned(event.getAuthor());
|
||||
MessageText.sendTimed(event.getChannel(), "**STOP spamming, " + mention + "! You have been warned!**", 3);
|
||||
MessageText.sendTimed(event.getTextChannel(), "**STOP spamming, " + mention + "! You have been warned!**", 3);
|
||||
biscuit.log(BColor.MAGENTA_BOLD + "User " + event.getAuthor().getName() + " has been warned for spam!");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ public class MessageText {
|
|||
return;
|
||||
}
|
||||
final Biscuit b = Biscuit.getBiscuit(c.getGuild());
|
||||
c.sendMessage(message).submit().whenComplete((msg, error) -> {
|
||||
c.sendMessageEmbeds(message).submit().whenComplete((msg, error) -> {
|
||||
if(error != null) {
|
||||
b.warn("Message embed did not send: " + message);
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ public class MessageText {
|
|||
return;
|
||||
}
|
||||
final Biscuit b = Biscuit.getBiscuit(c.getGuild());
|
||||
c.sendMessage(message).submit()
|
||||
c.sendMessageEmbeds(message).submit()
|
||||
.whenComplete((msg, error) -> {
|
||||
if(error != null) {
|
||||
b.warn("Timed message embed did not send - Time: " + seconds + " Text: " + message);
|
||||
|
|
|
@ -11,7 +11,6 @@ import net.dv8tion.jda.api.JDA;
|
|||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.entities.MessageChannel;
|
||||
import net.dv8tion.jda.api.entities.User;
|
||||
import net.dv8tion.jda.api.events.message.priv.PrivateMessageReceivedEvent;
|
||||
|
||||
public class CaptchaUser implements Iterable<PreUser>{
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ public class PreUser {
|
|||
|
||||
public void kick() {
|
||||
remove();
|
||||
biscuit.getGuild().kick(user.getId()).submit();
|
||||
biscuit.getGuild().getMemberById(user.getId()).kick().submit();
|
||||
}
|
||||
|
||||
public boolean equals(User u) {
|
||||
|
|
|
@ -5,17 +5,20 @@ import com.fpghoti.biscuit.logging.BColor;
|
|||
import com.vdurmont.emoji.EmojiParser;
|
||||
|
||||
import net.dv8tion.jda.api.entities.Emote;
|
||||
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
|
||||
public class ChatFilter {
|
||||
|
||||
public static String[] suffixes = {"ing","s","ed","er","es","y","ers","ier","iest","ies","ys"};
|
||||
|
||||
public static boolean filter(GuildMessageReceivedEvent event) {
|
||||
public static boolean filter(MessageReceivedEvent event) {
|
||||
return filter(event, true);
|
||||
}
|
||||
|
||||
public static boolean filter(GuildMessageReceivedEvent event, boolean silent) {
|
||||
public static boolean filter(MessageReceivedEvent event, boolean silent) {
|
||||
if(!event.isFromGuild()) {
|
||||
return false;
|
||||
}
|
||||
Biscuit biscuit = Biscuit.getBiscuit(event.getGuild());
|
||||
String msg = event.getMessage().getContentDisplay();
|
||||
|
||||
|
|
Loading…
Reference in New Issue