Cleaned up captcha

This commit is contained in:
2020-08-04 22:29:55 -05:00
parent eb3a5d2990
commit b63ec31138
49 changed files with 815 additions and 434 deletions

View File

@@ -9,6 +9,7 @@ import com.fpghoti.biscuit.commands.base.ClientCommand;
import com.fpghoti.biscuit.commands.base.ConsoleCommand;
import com.fpghoti.biscuit.commands.base.CustomCommand;
import com.fpghoti.biscuit.commands.base.MusicClientCommand;
import com.fpghoti.biscuit.rest.MessageText;
import com.fpghoti.biscuit.util.PermUtil;
import com.fpghoti.biscuit.util.Util;
@@ -119,7 +120,7 @@ public class CommandManager {
public static void commandReply(GuildMessageReceivedEvent event, String msg) {
if(event != null) {
event.getChannel().sendMessage(msg).queue();
MessageText.send(event.getChannel(), msg);
}else {
Main.getLogger().info(msg);
}

View File

@@ -3,6 +3,7 @@ package com.fpghoti.biscuit.commands.client;
import com.fpghoti.biscuit.Main;
import com.fpghoti.biscuit.biscuit.Biscuit;
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;
@@ -30,7 +31,7 @@ public class AddCommand extends ClientCommand{
if(end.equals(".0")) {
sum = sum.replace(".0","");
}
event.getChannel().sendMessage(args[0] + " + " + args[1] + " is **" + sum + "**.").queue();
MessageText.send(event.getChannel(), args[0] + " + " + args[1] + " is **" + sum + "**.");
}
}

View File

@@ -3,6 +3,7 @@ package com.fpghoti.biscuit.commands.client;
import com.fpghoti.biscuit.Main;
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;
@@ -22,7 +23,7 @@ public class ChanIDCommand extends ClientCommand{
Biscuit b = Biscuit.getBiscuit(event.getGuild());
b.log(event.getAuthor().getName() + " issued a command: -chanid");
String id = event.getChannel().getId();
event.getChannel().sendMessage(id).queue();
MessageText.send(event.getChannel(), id);
}
}

View File

@@ -3,6 +3,7 @@ package com.fpghoti.biscuit.commands.client;
import com.fpghoti.biscuit.Main;
import com.fpghoti.biscuit.biscuit.Biscuit;
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;
@@ -31,7 +32,7 @@ public class DivideCommand extends ClientCommand{
if(end.equals(".0")) {
divide = divide.replace(".0","");
}
event.getChannel().sendMessage(args[0] + " / " + args[1] + " is **" + divide + "**.").queue();
MessageText.send(event.getChannel(), args[0] + " / " + args[1] + " is **" + divide + "**.");
}
}

View File

@@ -3,6 +3,7 @@ package com.fpghoti.biscuit.commands.client;
import com.fpghoti.biscuit.Main;
import com.fpghoti.biscuit.biscuit.Biscuit;
import com.fpghoti.biscuit.commands.base.MusicClientCommand;
import com.fpghoti.biscuit.rest.MessageText;
import com.fpghoti.biscuit.util.PermUtil;
import net.dv8tion.jda.api.entities.MessageEmbed;
@@ -24,10 +25,10 @@ public class ForceSkipCommand extends MusicClientCommand{
Biscuit b = Biscuit.getBiscuit(event.getGuild());
b.log(event.getAuthor().getName() + " issued a command: -forceskip");
if(PermUtil.isMod(event.getMember())) {
event.getChannel().sendMessage("Force skipping current song.").queue();
MessageText.send(event.getChannel(), "Force skipping current song.");
if(b.getAudioScheduler().getQueue().getNext() != null ) {
MessageEmbed next = b.getAudioScheduler().getQueue().getNext().getEmbedMessage("Now Playing:");
event.getChannel().sendMessage(next).queue();
MessageText.send(event.getChannel(), next);
}
b.getAudioScheduler().skip();
}

View File

@@ -1,15 +1,12 @@
package com.fpghoti.biscuit.commands.client;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import com.fpghoti.biscuit.Main;
import com.fpghoti.biscuit.biscuit.Biscuit;
import com.fpghoti.biscuit.commands.base.ClientCommand;
import com.fpghoti.biscuit.logging.BColor;
import com.fpghoti.biscuit.rest.MessageText;
import com.fpghoti.biscuit.util.PermUtil;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
public class GetConfigCommand extends ClientCommand{
@@ -31,14 +28,8 @@ public class GetConfigCommand extends ClientCommand{
event.getChannel().sendFile(b.getConfig().getFile(), "config-" + b.getProperties().getGuildCode() + ".properties").queue();
}else {
b.log(BColor.MAGENTA_BOLD + event.getAuthor().getName() + " lacks permission to view the config!");
event.getChannel().sendMessage(event.getAuthor().getAsMention() + " You do not have "
+ "permission to view the config.").queue(new Consumer<Message>()
{
@Override
public void accept(Message msg){
msg.delete().submitAfter(5, TimeUnit.SECONDS);
}
});
MessageText.sendTimed(event.getChannel(), event.getAuthor().getAsMention() + " You do not have "
+ "permission to view the config.", 5);
}
}

View File

@@ -3,6 +3,7 @@ package com.fpghoti.biscuit.commands.client;
import com.fpghoti.biscuit.Main;
import com.fpghoti.biscuit.biscuit.Biscuit;
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;
@@ -24,7 +25,7 @@ public class GuildIDCommand extends ClientCommand{
Biscuit b = Biscuit.getBiscuit(event.getGuild());
b.log(event.getAuthor().getName() + " issued a command: -guildid");
if(PermUtil.isMod(event.getMember())) {
event.getChannel().sendMessage(event.getGuild().getId()).queue();
MessageText.send(event.getChannel(), event.getGuild().getId());
}
}

View File

@@ -10,6 +10,7 @@ import com.fpghoti.biscuit.commands.CommandManager;
import com.fpghoti.biscuit.commands.base.ClientCommand;
import com.fpghoti.biscuit.commands.base.CustomCommand;
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;
@@ -35,7 +36,7 @@ public class HelpCommand extends ClientCommand {
if(Util.isDigit(args[0])) {
pg = Integer.parseInt(args[0]);
}else {
event.getChannel().sendMessage("Usage: ``" + usage + "``").queue();
MessageText.send(event.getChannel(), "Usage: ``" + usage + "``");
}
}
List<BaseCommand> commands = new ArrayList<BaseCommand>();
@@ -72,8 +73,8 @@ public class HelpCommand extends ClientCommand {
pg = pageCount;
}
event.getChannel().sendMessage("**Use " + Main.getMainBiscuit().getProperties().getCommandSignifier() + "help [Page #] to navigate the different pages.**").queue();
event.getChannel().sendMessage("[" + Integer.toString(pg) + "/" + Integer.toString(pageCount) + "] **Bot Commands:**").queue();
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:**");
String msg = "";
for (int i = 0; i < 8; i++) {
int index = (pg - 1) * 8 + i;
@@ -88,8 +89,7 @@ public class HelpCommand extends ClientCommand {
msg = msg + line;
}
}
event.getChannel().sendMessage(msg).queue();
MessageText.send(event.getChannel(), msg);
}
}

View File

@@ -3,6 +3,7 @@ package com.fpghoti.biscuit.commands.client;
import com.fpghoti.biscuit.Main;
import com.fpghoti.biscuit.biscuit.Biscuit;
import com.fpghoti.biscuit.commands.base.MusicClientCommand;
import com.fpghoti.biscuit.rest.MessageText;
import com.fpghoti.biscuit.util.PermUtil;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
@@ -24,10 +25,10 @@ public class LoopMusicCommand extends MusicClientCommand{
b.log(event.getAuthor().getName() + " issued a command: -loopmusic");
if(PermUtil.isMod(event.getMember())) {
if(!b.getAudioScheduler().isLooping()) {
event.getChannel().sendMessage("Setting all music to loop.").queue();
MessageText.send(event.getChannel(), "Setting all music to loop.");
b.getAudioScheduler().setLooping(true);
}else {
event.getChannel().sendMessage("Disabling music looping.").queue();
MessageText.send(event.getChannel(), "Disabling music looping.");
b.getAudioScheduler().setLooping(false);
}

View File

@@ -3,6 +3,7 @@ package com.fpghoti.biscuit.commands.client;
import com.fpghoti.biscuit.Main;
import com.fpghoti.biscuit.biscuit.Biscuit;
import com.fpghoti.biscuit.commands.base.ClientCommand;
import com.fpghoti.biscuit.rest.MessageText;
import com.fpghoti.biscuit.util.PermUtil;
import com.fpghoti.biscuit.util.Util;
@@ -39,7 +40,7 @@ public class MakeInviteCommand extends ClientCommand{
}
}
if(doubAge > 86400) {
event.getChannel().sendMessage("That length is longer than what Discord allows. Please try again. (Max 24 hours)").queue();
MessageText.send(event.getChannel(), "That length is longer than what Discord allows. Please try again. (Max 24 hours)");
return;
}
final double db = doubAge;
@@ -49,7 +50,7 @@ public class MakeInviteCommand extends ClientCommand{
if(db > 0) {
exp = args[1] + " hour(s)";
}
event.getChannel().sendMessage("Created invite **" + i.getCode() + "** Expiration: **" + exp + "**.").queue();
MessageText.send(event.getChannel(), "Created invite **" + i.getCode() + "** Expiration: **" + exp + "**.");
});
}
}

View File

@@ -3,6 +3,7 @@ package com.fpghoti.biscuit.commands.client;
import com.fpghoti.biscuit.Main;
import com.fpghoti.biscuit.biscuit.Biscuit;
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;
@@ -31,7 +32,7 @@ public class MultiplyCommand extends ClientCommand{
if(end.equals(".0")) {
prod = prod.replace(".0","");
}
event.getChannel().sendMessage(args[0] + " x " + args[1] + " is **" + prod + "**.").queue();
MessageText.send(event.getChannel(), args[0] + " x " + args[1] + " is **" + prod + "**.");
}
}

View File

@@ -3,6 +3,7 @@ package com.fpghoti.biscuit.commands.client;
import com.fpghoti.biscuit.Main;
import com.fpghoti.biscuit.biscuit.Biscuit;
import com.fpghoti.biscuit.commands.base.ClientCommand;
import com.fpghoti.biscuit.rest.MessageText;
import com.fpghoti.biscuit.util.PermUtil;
import net.dv8tion.jda.api.entities.Member;
@@ -29,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);
event.getChannel().sendMessage(s+ " is no longer flagged as spam.").queue();
MessageText.send(event.getChannel(), s + " is no longer flagged as spam.");
}
}
}

View File

@@ -3,6 +3,7 @@ package com.fpghoti.biscuit.commands.client;
import com.fpghoti.biscuit.Main;
import com.fpghoti.biscuit.biscuit.Biscuit;
import com.fpghoti.biscuit.commands.base.MusicClientCommand;
import com.fpghoti.biscuit.rest.MessageText;
import net.dv8tion.jda.api.entities.MessageEmbed;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
@@ -24,9 +25,9 @@ public class NowPlayingCommand extends MusicClientCommand{
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);
event.getChannel().sendMessage(next).queue();
MessageText.send(event.getChannel(), next);
}else {
event.getChannel().sendMessage("No song is currently playing.").queue();
MessageText.send(event.getChannel(), "No song is currently playing.");
}
}

View File

@@ -3,6 +3,7 @@ package com.fpghoti.biscuit.commands.client;
import com.fpghoti.biscuit.Main;
import com.fpghoti.biscuit.biscuit.Biscuit;
import com.fpghoti.biscuit.commands.base.MusicClientCommand;
import com.fpghoti.biscuit.rest.MessageText;
import com.fpghoti.biscuit.util.PermUtil;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
@@ -25,9 +26,9 @@ public class PauseCommand extends MusicClientCommand{
if(PermUtil.isMod(event.getMember())) {
if(!b.getAudioPlayer().isPaused()) {
b.getAudioPlayer().setPaused(true);
event.getChannel().sendMessage("Paused the current track.").queue();
MessageText.send(event.getChannel(), "Paused the current track.");
}else {
event.getChannel().sendMessage("The music player is already paused.").queue();
MessageText.send(event.getChannel(), "The music player is already paused.");
}
}
}

View File

@@ -3,6 +3,7 @@ package com.fpghoti.biscuit.commands.client;
import com.fpghoti.biscuit.Main;
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;
@@ -21,7 +22,7 @@ public class PingCommand extends ClientCommand{
public void execute(String[] args, GuildMessageReceivedEvent event) {
Biscuit b = Biscuit.getBiscuit(event.getGuild());
b.log(event.getAuthor().getName() + " issued a command: -ping");
event.getChannel().sendMessage("Pong!").queue();
MessageText.send(event.getChannel(), "Pong!");
}
}

View File

@@ -5,6 +5,7 @@ import com.fpghoti.biscuit.audio.AudioHandler;
import com.fpghoti.biscuit.audio.AudioResultHandler;
import com.fpghoti.biscuit.biscuit.Biscuit;
import com.fpghoti.biscuit.commands.base.MusicClientCommand;
import com.fpghoti.biscuit.rest.MessageText;
import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager;
import net.dv8tion.jda.api.entities.Guild;
@@ -41,7 +42,7 @@ public class PlayCommand extends MusicClientCommand{
String vcname = "";
if(!event.getMember().getVoiceState().inVoiceChannel()) {
tchannel.sendMessage("You must be in a voice channel to do this!").queue();
MessageText.send(tchannel, "You must be in a voice channel to do this!");
return;
}
vcname = event.getMember().getVoiceState().getChannel().getName();
@@ -55,14 +56,14 @@ public class PlayCommand extends MusicClientCommand{
}
}
if(found == false) {
tchannel.sendMessage("You are not in a channel that is authorized to use the music player.").queue();
MessageText.send(tchannel, "You are not in a channel that is authorized to use the music player.");
return;
}
}
if(b.getAudioPlayer().getPlayingTrack() != null && guild.getAudioManager().isConnected() && !guild.getAudioManager().getConnectedChannel().getMembers().contains(event.getMember())) {
tchannel.sendMessage("Music is already playing in a voice channel. Connect to "
+ "that channel, then queue your song.").queue();
MessageText.send(tchannel, "Music is already playing in a voice channel. Connect to "
+ "that channel, then queue your song.");
return;
}

View File

@@ -5,6 +5,7 @@ import com.fpghoti.biscuit.audio.AudioHandler;
import com.fpghoti.biscuit.audio.AudioResultHandler;
import com.fpghoti.biscuit.biscuit.Biscuit;
import com.fpghoti.biscuit.commands.base.MusicClientCommand;
import com.fpghoti.biscuit.rest.MessageText;
import com.fpghoti.biscuit.util.PermUtil;
import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager;
@@ -43,12 +44,12 @@ public class PlayFirstCommand extends MusicClientCommand{
String vcname = "";
if(!PermUtil.isMod(event.getMember())) {
tchannel.sendMessage("You do not have permission to do this!").queue();
MessageText.send(tchannel, "You do not have permission to do this!");
return;
}
if(!event.getMember().getVoiceState().inVoiceChannel()) {
tchannel.sendMessage("You must be in a voice channel to do this!").queue();
MessageText.send(tchannel, "You must be in a voice channel to do this!");
return;
}
vcname = event.getMember().getVoiceState().getChannel().getName();
@@ -62,14 +63,14 @@ public class PlayFirstCommand extends MusicClientCommand{
}
}
if(found == false) {
tchannel.sendMessage("You are not in a channel that is authorized to use the music player.").queue();
MessageText.send(tchannel, "You are not in a channel that is authorized to use the music player.");
return;
}
}
if(b.getAudioPlayer().getPlayingTrack() != null && guild.getAudioManager().isConnected() && !guild.getAudioManager().getConnectedChannel().getMembers().contains(event.getMember())) {
tchannel.sendMessage("Music is already playing in a voice channel. Connect to "
+ "that channel, then queue your song.").queue();
MessageText.send(tchannel, "Music is already playing in a voice channel. Connect to "
+ "that channel, then queue your song.");
return;
}

View File

@@ -3,6 +3,7 @@ package com.fpghoti.biscuit.commands.client;
import com.fpghoti.biscuit.Main;
import com.fpghoti.biscuit.biscuit.Biscuit;
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;
@@ -31,7 +32,7 @@ public class PowerCommand extends ClientCommand{
if(end.equals(".0")) {
pow = pow.replace(".0","");
}
event.getChannel().sendMessage(args[0] + "^" + args[1] + " is **" + pow + "**.").queue();
MessageText.send(event.getChannel(), args[0] + "^" + args[1] + " is **" + pow + "**.");
}
}

View File

@@ -5,6 +5,7 @@ import com.fpghoti.biscuit.audio.queue.AudioQueue;
import com.fpghoti.biscuit.audio.queue.QueuedTrack;
import com.fpghoti.biscuit.biscuit.Biscuit;
import com.fpghoti.biscuit.commands.base.MusicClientCommand;
import com.fpghoti.biscuit.rest.MessageText;
import com.fpghoti.biscuit.util.Util;
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
@@ -32,7 +33,7 @@ public class QueueCommand extends MusicClientCommand{
if(Util.isDigit(args[0])) {
pg = Integer.parseInt(args[0]);
}else {
event.getChannel().sendMessage("Usage: ``" + usage + "``").queue();
MessageText.send(event.getChannel(), "Usage: ``" + usage + "``");
}
}
@@ -45,15 +46,15 @@ public class QueueCommand extends MusicClientCommand{
if(queue.size() == 0) {
if(biscuit.getAudioPlayer().getPlayingTrack() == null) {
event.getChannel().sendMessage("There is currently no song playing.").queue();
MessageText.send(event.getChannel(), "There is currently no song playing.");
}else {
event.getChannel().sendMessage("Nothing is queued to play after the current track.").queue();
MessageText.send(event.getChannel(), "Nothing is queued to play after the current track.");
}
return;
}
event.getChannel().sendMessage("**Use " + Main.getMainBiscuit().getProperties().getCommandSignifier() + "queue [Page #] to navigate the different pages.**").queue();
event.getChannel().sendMessage("[" + Integer.toString(pg) + "/" + Integer.toString(pageCount) + "] ** Upcoming Music Tracks:**").queue();
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:**");
String msg = "";
for (int i = 0; i < 8; i++) {
int index = (pg - 1) * 8 + i;
@@ -75,7 +76,7 @@ public class QueueCommand extends MusicClientCommand{
msg = msg + line;
}
}
event.getChannel().sendMessage(msg).queue();
MessageText.send(event.getChannel(), msg);
}

View File

@@ -3,6 +3,7 @@ package com.fpghoti.biscuit.commands.client;
import com.fpghoti.biscuit.Main;
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;
@@ -22,7 +23,7 @@ public class RecentSpammersCommand extends ClientCommand{
Biscuit b = Biscuit.getBiscuit(event.getGuild());
b.log(event.getAuthor().getName() + " issued a command: -recentspammers");
String msg = b.getMessageStore().getSpammerList();
event.getChannel().sendMessage(msg).queue();
MessageText.send(event.getChannel(), msg);
}

View File

@@ -1,16 +1,14 @@
package com.fpghoti.biscuit.commands.client;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import com.fpghoti.biscuit.Main;
import com.fpghoti.biscuit.biscuit.Biscuit;
import com.fpghoti.biscuit.commands.base.ClientCommand;
import com.fpghoti.biscuit.logging.BColor;
import com.fpghoti.biscuit.rest.MessageText;
import com.fpghoti.biscuit.util.PermUtil;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.Message.Attachment;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
@@ -39,35 +37,17 @@ public class SaveConfigCommand extends ClientCommand{
b = Biscuit.loadGuild(event.getGuild());
}
}else {
event.getChannel().sendMessage(event.getAuthor().getAsMention() + " Too many attachments added! "
+ "Please only include the config file you want to save.").queue(new Consumer<Message>()
{
@Override
public void accept(Message msg){
msg.delete().submitAfter(5, TimeUnit.SECONDS);
}
});
MessageText.sendTimed(event.getChannel(), event.getAuthor().getAsMention() + " Too many attachments added! "
+ "Please only include the config file you want to save.", 5);
}
}else {
event.getChannel().sendMessage(event.getAuthor().getAsMention() + " You need to send "
+ "a file in order to save the config.").queue(new Consumer<Message>()
{
@Override
public void accept(Message msg){
msg.delete().submitAfter(5, TimeUnit.SECONDS);
}
});
MessageText.sendTimed(event.getChannel(), 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!");
event.getChannel().sendMessage(event.getAuthor().getAsMention() + " You do not have "
+ "permission to save the config.").queue(new Consumer<Message>()
{
@Override
public void accept(Message msg){
msg.delete().submitAfter(5, TimeUnit.SECONDS);
}
});
MessageText.sendTimed(event.getChannel(), event.getAuthor().getAsMention() + " You do not have "
+ "permission to save the config.", 5);
}
}

View File

@@ -3,6 +3,7 @@ package com.fpghoti.biscuit.commands.client;
import com.fpghoti.biscuit.Main;
import com.fpghoti.biscuit.biscuit.Biscuit;
import com.fpghoti.biscuit.commands.base.MusicClientCommand;
import com.fpghoti.biscuit.rest.MessageText;
import net.dv8tion.jda.api.entities.MessageEmbed;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
@@ -27,41 +28,41 @@ public class SkipCommand extends MusicClientCommand{
b.log(event.getAuthor().getName() + " issued a command: -skip");
if(b.getAudioPlayer().getPlayingTrack() == null) {
event.getChannel().sendMessage("There is not a song playing for you to skip!").queue();
MessageText.send(event.getChannel(), "There is not a song playing for you to skip!");
return;
}
if(!event.getGuild().getAudioManager().getConnectedChannel().getMembers().contains(event.getMember())) {
event.getChannel().sendMessage("You need to be in the same voice channel in order to skip!").queue();
MessageText.send(event.getChannel(), "You need to be in the same voice channel in order to skip!");
return;
}
if(b.getAudioScheduler().getVotes() >= (event.getGuild().getAudioManager().getConnectedChannel().getMembers().size() - 1) / 2) {
event.getChannel().sendMessage("Skip vote status: **[" + ( b.getAudioScheduler().getVotes() + 1) + "/"
MessageText.send(event.getChannel(), "Skip vote status: **[" + ( b.getAudioScheduler().getVotes() + 1) + "/"
+ (event.getGuild().getAudioManager().getConnectedChannel().getMembers().size() - 1) + "]**"
+ "\nSkipping current track.").queue();
+ "\nSkipping current track.");
if(b.getAudioScheduler().getQueue().getNext() != null ) {
MessageEmbed next = b.getAudioScheduler().getQueue().getNext().getEmbedMessage("Now Playing:");
event.getChannel().sendMessage(next).queue();
MessageText.send(event.getChannel(), next);
}
b.getAudioScheduler().skip();
return;
}
if(b.getAudioScheduler().voteSkip(event.getAuthor().getId())) {
event.getChannel().sendMessage("You voted to skip the current track.").queue();
MessageText.send(event.getChannel(), "You voted to skip the current track.");
}else {
event.getChannel().sendMessage("You cannot vote to skip this track again."
MessageText.send(event.getChannel(), "You cannot vote to skip this track again."
+ "\nSkip vote status: **[" + b.getAudioScheduler().getVotes() + "/"
+ (event.getGuild().getAudioManager().getConnectedChannel().getMembers().size() - 1) + "]**").queue();
+ (event.getGuild().getAudioManager().getConnectedChannel().getMembers().size() - 1) + "]**");
}
if(b.getAudioScheduler().getVotes() >= (event.getGuild().getAudioManager().getConnectedChannel().getMembers().size() - 1) / 2) {
event.getChannel().sendMessage("Skip vote status: **[" + b.getAudioScheduler().getVotes() + "/"
MessageText.send(event.getChannel(), "Skip vote status: **[" + b.getAudioScheduler().getVotes() + "/"
+ event.getGuild().getAudioManager().getConnectedChannel().getMembers().size() + "]**"
+ "\nSkipping current track.").queue();
+ "\nSkipping current track.");
if(b.getAudioScheduler().getQueue().getNext() != null ) {
MessageEmbed next = b.getAudioScheduler().getQueue().getNext().getEmbedMessage("Now Playing:");
event.getChannel().sendMessage(next).queue();
MessageText.send(event.getChannel(), next);
}
b.getAudioScheduler().skip();
}

View File

@@ -1,15 +1,12 @@
package com.fpghoti.biscuit.commands.client;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import com.fpghoti.biscuit.Main;
import com.fpghoti.biscuit.biscuit.Biscuit;
import com.fpghoti.biscuit.commands.base.ClientCommand;
import com.fpghoti.biscuit.rest.MessageText;
import com.fpghoti.biscuit.util.PermUtil;
import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.User;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
@@ -32,19 +29,13 @@ public class SoftMuteCommand extends ClientCommand{
User u = m.getUser();
String s = u.getAsMention();
if(b.getMessageStore().isSoftmuted(u)) {
event.getChannel().sendMessage(s+ " is already softmuted.").queue(new Consumer<Message>()
{
@Override
public void accept(Message msg){
msg.delete().reason("Automatic bot message removal").submitAfter(3, TimeUnit.SECONDS);
}
});
MessageText.sendTimed(event.getChannel(), 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();
event.getChannel().sendMessage(s+ " is now soft-muted. They will now be only able to send one message every two minutes.").queue();
MessageText.send(event.getChannel(), s + " is now soft-muted. They will now be only able to send one message every two minutes.");
}
}
}

View File

@@ -3,6 +3,7 @@ package com.fpghoti.biscuit.commands.client;
import com.fpghoti.biscuit.Main;
import com.fpghoti.biscuit.biscuit.Biscuit;
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;
@@ -30,7 +31,7 @@ public class SquareRootCommand extends ClientCommand{
if(end.equals(".0")) {
root = root.replace(".0","");
}
event.getChannel().sendMessage("The sqaure root of " + args[0] + " is **" + root + "**.").queue();
MessageText.send(event.getChannel(), "The sqaure root of " + args[0] + " is **" + root + "**.");
}
}

View File

@@ -3,6 +3,7 @@ package com.fpghoti.biscuit.commands.client;
import com.fpghoti.biscuit.Main;
import com.fpghoti.biscuit.biscuit.Biscuit;
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;
@@ -31,7 +32,7 @@ public class SubtractCommand extends ClientCommand{
if(end.equals(".0")) {
sub = sub.replace(".0","");
}
event.getChannel().sendMessage(args[0] + " - " + args[1] + " is **" + sub + "**.").queue();
MessageText.send(event.getChannel(), args[0] + " - " + args[1] + " is **" + sub + "**.");
}
}

View File

@@ -3,6 +3,7 @@ package com.fpghoti.biscuit.commands.client;
import com.fpghoti.biscuit.Main;
import com.fpghoti.biscuit.biscuit.Biscuit;
import com.fpghoti.biscuit.commands.base.MusicClientCommand;
import com.fpghoti.biscuit.rest.MessageText;
import com.fpghoti.biscuit.util.PermUtil;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
@@ -26,10 +27,10 @@ public class TogglePauseCommand extends MusicClientCommand{
if(PermUtil.isMod(event.getMember())) {
if(b.getAudioPlayer().isPaused()) {
b.getAudioPlayer().setPaused(false);
event.getChannel().sendMessage("Unpaused the current track.").queue();
MessageText.send(event.getChannel(), "Unpaused the current track.");
}else {
b.getAudioPlayer().setPaused(true);
event.getChannel().sendMessage("Paused the current track.").queue();
MessageText.send(event.getChannel(), "Paused the current track.");
}
}
}

View File

@@ -3,6 +3,7 @@ package com.fpghoti.biscuit.commands.client;
import com.fpghoti.biscuit.Main;
import com.fpghoti.biscuit.biscuit.Biscuit;
import com.fpghoti.biscuit.commands.base.ClientCommand;
import com.fpghoti.biscuit.rest.MessageText;
import com.fpghoti.biscuit.util.PermUtil;
import net.dv8tion.jda.api.entities.Emote;
@@ -37,7 +38,7 @@ public class ToggleRoleCommand extends ClientCommand{
}
if(rolename.equals("")) {
event.getChannel().sendMessage("Sorry! This role either cannot be toggled or does not exist!").queue();
MessageText.send(event.getChannel(), "Sorry! This role either cannot be toggled or does not exist!");
return;
}

View File

@@ -3,6 +3,7 @@ package com.fpghoti.biscuit.commands.client;
import com.fpghoti.biscuit.Main;
import com.fpghoti.biscuit.biscuit.Biscuit;
import com.fpghoti.biscuit.commands.base.ClientCommand;
import com.fpghoti.biscuit.rest.MessageText;
import com.fpghoti.biscuit.util.PermUtil;
import net.dv8tion.jda.api.entities.Member;
@@ -27,7 +28,7 @@ public class UIDCommand extends ClientCommand{
for(Member m : event.getMessage().getMentionedMembers()){
User u = m.getUser();
if(PermUtil.isMod(event.getMember())) {
event.getChannel().sendMessage(u.getId()).queue();
MessageText.send(event.getChannel(), u.getId());
}
}
}

View File

@@ -3,6 +3,7 @@ package com.fpghoti.biscuit.commands.client;
import com.fpghoti.biscuit.Main;
import com.fpghoti.biscuit.biscuit.Biscuit;
import com.fpghoti.biscuit.commands.base.ClientCommand;
import com.fpghoti.biscuit.rest.MessageText;
import com.fpghoti.biscuit.util.PermUtil;
import net.dv8tion.jda.api.entities.Member;
@@ -29,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);
event.getChannel().sendMessage(s+ " is no longer soft-muted.").queue();
MessageText.send(event.getChannel(), s + " is no longer soft-muted.");
}
}
}

View File

@@ -3,6 +3,7 @@ package com.fpghoti.biscuit.commands.client;
import com.fpghoti.biscuit.Main;
import com.fpghoti.biscuit.biscuit.Biscuit;
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;
@@ -25,9 +26,9 @@ public class UnpauseCommand extends ClientCommand{
if(PermUtil.isMod(event.getMember())) {
if(b.getAudioPlayer().isPaused()) {
b.getAudioPlayer().setPaused(false);
event.getChannel().sendMessage("Unpaused the current track.").queue();
MessageText.send(event.getChannel(), "Unpaused the current track.");
}else {
event.getChannel().sendMessage("The music player is not paused.").queue();
MessageText.send(event.getChannel(), "The music player is not paused.");
}
}
}

View File

@@ -3,6 +3,7 @@ package com.fpghoti.biscuit.commands.client;
import com.fpghoti.biscuit.Main;
import com.fpghoti.biscuit.biscuit.Biscuit;
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;
@@ -23,7 +24,7 @@ public class WikiCommand extends ClientCommand{
Biscuit b = Biscuit.getBiscuit(event.getGuild());
b.log(event.getAuthor().getName() + " issued a command: -wiki");
if(PermUtil.isMod(event.getMember())) {
event.getChannel().sendMessage("https://git.fpghoti.com/thmsdy/Biscuit/wiki").queue();
MessageText.send(event.getChannel(), "https://git.fpghoti.com/thmsdy/Biscuit/wiki");
}
}

View File

@@ -3,6 +3,7 @@ package com.fpghoti.biscuit.commands.client;
import com.fpghoti.biscuit.Main;
import com.fpghoti.biscuit.biscuit.Biscuit;
import com.fpghoti.biscuit.commands.base.MusicClientCommand;
import com.fpghoti.biscuit.rest.MessageText;
import com.fpghoti.biscuit.util.PermUtil;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
@@ -25,7 +26,7 @@ public class WipeQueueCommand extends MusicClientCommand{
b.log(event.getAuthor().getName() + " issued a command: -wipequeue");
if(PermUtil.isMod(event.getMember())) {
b.getAudioScheduler().wipeQueue();
event.getChannel().sendMessage("Removed upcoming songs from the music queue.").queue();
MessageText.send(event.getChannel(), "Removed upcoming songs from the music queue.");
}
}

View File

@@ -3,6 +3,7 @@ package com.fpghoti.biscuit.commands.console;
import com.fpghoti.biscuit.Main;
import com.fpghoti.biscuit.biscuit.Biscuit;
import com.fpghoti.biscuit.commands.base.ConsoleCommand;
import com.fpghoti.biscuit.rest.MessageText;
import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.entities.TextChannel;
@@ -41,7 +42,7 @@ public class GuildSayCommand extends ConsoleCommand{
for(TextChannel c : guild.getTextChannels()) {
if(c.getName().equalsIgnoreCase(channel) || c.getName().equalsIgnoreCase("#" + channel)) {
c.sendMessage(message).queue();
MessageText.send(c, message);
}
}

View File

@@ -3,6 +3,7 @@ package com.fpghoti.biscuit.commands.console;
import com.fpghoti.biscuit.Main;
import com.fpghoti.biscuit.biscuit.Biscuit;
import com.fpghoti.biscuit.commands.base.ConsoleCommand;
import com.fpghoti.biscuit.rest.MessageText;
import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.entities.TextChannel;
@@ -37,7 +38,7 @@ public class SayCommand extends ConsoleCommand{
for(TextChannel c : guild.getTextChannels()) {
if(c.getName().equalsIgnoreCase(target) || c.getName().equalsIgnoreCase("#" + target)) {
c.sendMessage(message).queue();
MessageText.send(c, message);
}
}