begin update to newer JDA
This commit is contained in:
@@ -120,7 +120,7 @@ public class CommandManager {
|
||||
|
||||
public static void commandReply(MessageReceivedEvent event, String msg) {
|
||||
if(event != null) {
|
||||
MessageText.send(event.getTextChannel(), msg);
|
||||
MessageText.send(event.getChannel().asTextChannel(), msg);
|
||||
}else {
|
||||
Main.getLogger().info(msg);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,8 @@ 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;
|
||||
//import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
|
||||
public class GuildSayCommand extends ConsoleCommand{
|
||||
|
||||
|
||||
@@ -6,7 +6,8 @@ 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;
|
||||
//import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
|
||||
public class SayCommand extends ConsoleCommand{
|
||||
|
||||
|
||||
@@ -6,6 +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.entities.channel.concrete.TextChannel;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
|
||||
public class AddCommand extends ClientCommand{
|
||||
@@ -31,7 +32,7 @@ public class AddCommand extends ClientCommand{
|
||||
if(end.equals(".0")) {
|
||||
sum = sum.replace(".0","");
|
||||
}
|
||||
MessageText.send(event.getTextChannel(), args[0] + " + " + args[1] + " is **" + sum + "**.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), args[0] + " + " + args[1] + " is **" + sum + "**.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,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();
|
||||
MessageText.send(event.getTextChannel(), id);
|
||||
MessageText.send(event.getChannel().asTextChannel(), id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public class DivideCommand extends ClientCommand{
|
||||
if(end.equals(".0")) {
|
||||
divide = divide.replace(".0","");
|
||||
}
|
||||
MessageText.send(event.getTextChannel(), args[0] + " / " + args[1] + " is **" + divide + "**.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), args[0] + " / " + args[1] + " is **" + divide + "**.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.fpghoti.biscuit.commands.discord;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
import com.fpghoti.biscuit.commands.base.ClientCommand;
|
||||
@@ -8,6 +10,7 @@ import com.fpghoti.biscuit.rest.MessageText;
|
||||
import com.fpghoti.biscuit.util.PermUtil;
|
||||
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.utils.FileUpload;
|
||||
|
||||
public class GetConfigCommand extends ClientCommand{
|
||||
|
||||
@@ -25,10 +28,14 @@ public class GetConfigCommand extends ClientCommand{
|
||||
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();
|
||||
File config = b.getConfig().getFile();
|
||||
FileUpload confUpload = FileUpload.fromData(config);
|
||||
confUpload.setName("config-" + b.getProperties().getGuildCode() + ".properties");
|
||||
//event.getChannel().sendFile(config, "config-" + b.getProperties().getGuildCode() + ".properties").queue();
|
||||
event.getChannel().asTextChannel().sendFiles(confUpload);
|
||||
}else {
|
||||
b.log(BColor.MAGENTA_BOLD + event.getAuthor().getName() + " lacks permission to view the config!");
|
||||
MessageText.sendTimed(event.getTextChannel(), event.getAuthor().getAsMention() + " You do not have "
|
||||
MessageText.sendTimed(event.getChannel().asTextChannel(), event.getAuthor().getAsMention() + " You do not have "
|
||||
+ "permission to view the config.", 5);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,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())) {
|
||||
MessageText.send(event.getTextChannel(), event.getGuild().getId());
|
||||
MessageText.send(event.getChannel().asTextChannel(), event.getGuild().getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public class HelpCommand extends ClientCommand {
|
||||
if(Util.isDigit(args[0])) {
|
||||
pg = Integer.parseInt(args[0]);
|
||||
}else {
|
||||
MessageText.send(event.getTextChannel(), "Usage: ``" + usage + "``");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "Usage: ``" + usage + "``");
|
||||
}
|
||||
}
|
||||
List<BaseCommand> commands = new ArrayList<BaseCommand>();
|
||||
@@ -66,8 +66,8 @@ public class HelpCommand extends ClientCommand {
|
||||
pg = pageCount;
|
||||
}
|
||||
|
||||
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:**");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "**Use " + Main.getMainBiscuit().getProperties().getCommandSignifier() + "help [Page #] to navigate the different pages.**");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "[" + 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.getTextChannel(), msg);
|
||||
MessageText.send(event.getChannel().asTextChannel(), msg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,7 +8,8 @@ import com.fpghoti.biscuit.util.PermUtil;
|
||||
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.entities.channel.concrete.TextChannel;
|
||||
//import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
|
||||
public class MakeInviteCommand extends ClientCommand{
|
||||
@@ -40,7 +41,7 @@ public class MakeInviteCommand extends ClientCommand{
|
||||
}
|
||||
}
|
||||
if(doubAge > 86400) {
|
||||
MessageText.send(event.getTextChannel(), "That length is longer than what Discord allows. Please try again. (Max 24 hours)");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "That length is longer than what Discord allows. Please try again. (Max 24 hours)");
|
||||
return;
|
||||
}
|
||||
final double db = doubAge;
|
||||
@@ -50,7 +51,7 @@ public class MakeInviteCommand extends ClientCommand{
|
||||
if(db > 0) {
|
||||
exp = args[1] + " hour(s)";
|
||||
}
|
||||
MessageText.send(event.getTextChannel(), "Created invite **" + i.getCode() + "** Expiration: **" + exp + "**.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "Created invite **" + i.getCode() + "** Expiration: **" + exp + "**.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public class MultiplyCommand extends ClientCommand{
|
||||
if(end.equals(".0")) {
|
||||
prod = prod.replace(".0","");
|
||||
}
|
||||
MessageText.send(event.getTextChannel(), args[0] + " x " + args[1] + " is **" + prod + "**.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), args[0] + " x " + args[1] + " is **" + prod + "**.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,12 +25,12 @@ public class NotSpammerCommand extends ClientCommand{
|
||||
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()){
|
||||
for(Member m : event.getMessage().getMentions().getMembers()){
|
||||
User u = m.getUser();
|
||||
String s = u.getAsMention();
|
||||
if(event.getChannel().getName().equals("public-spam-test") || (PermUtil.isMod(event.getMember()))) {
|
||||
b.getMessageStore().removeSpammer(u);
|
||||
MessageText.send(event.getTextChannel(), s + " is no longer flagged as spam.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), s + " is no longer flagged as spam.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public class PingCommand extends ClientCommand{
|
||||
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.getTextChannel(), "Pong!");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "Pong!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public class PowerCommand extends ClientCommand{
|
||||
if(end.equals(".0")) {
|
||||
pow = pow.replace(".0","");
|
||||
}
|
||||
MessageText.send(event.getTextChannel(), args[0] + "^" + args[1] + " is **" + pow + "**.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), args[0] + "^" + args[1] + " is **" + pow + "**.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,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();
|
||||
MessageText.send(event.getTextChannel(), msg);
|
||||
MessageText.send(event.getChannel().asTextChannel(), msg);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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.getTextChannel());
|
||||
b.getConfig().replaceConfig(a, event.getChannel().asTextChannel());
|
||||
b.remove();
|
||||
b = Biscuit.loadGuild(event.getGuild());
|
||||
}
|
||||
}else {
|
||||
MessageText.sendTimed(event.getTextChannel(), event.getAuthor().getAsMention() + " Too many attachments added! "
|
||||
MessageText.sendTimed(event.getChannel().asTextChannel(), event.getAuthor().getAsMention() + " Too many attachments added! "
|
||||
+ "Please only include the config file you want to save.", 5);
|
||||
}
|
||||
}else {
|
||||
MessageText.sendTimed(event.getTextChannel(), event.getAuthor().getAsMention() + " You need to send "
|
||||
MessageText.sendTimed(event.getChannel().asTextChannel(), 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.getTextChannel(), event.getAuthor().getAsMention() + " You do not have "
|
||||
MessageText.sendTimed(event.getChannel().asTextChannel(), event.getAuthor().getAsMention() + " You do not have "
|
||||
+ "permission to save the config.", 5);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,17 +25,17 @@ public class SoftMuteCommand extends ClientCommand{
|
||||
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()){
|
||||
for(Member m : event.getMessage().getMentions().getMembers()){
|
||||
User u = m.getUser();
|
||||
String s = u.getAsMention();
|
||||
if(b.getMessageStore().isSoftmuted(u)) {
|
||||
MessageText.sendTimed(event.getTextChannel(), s + " is already softmuted.", 3);
|
||||
MessageText.sendTimed(event.getChannel().asTextChannel(), 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.getTextChannel(), s + " is now soft-muted. They will now be only able to send one message every two minutes.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), s + " is now soft-muted. They will now be only able to send one message every two minutes.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public class SquareRootCommand extends ClientCommand{
|
||||
if(end.equals(".0")) {
|
||||
root = root.replace(".0","");
|
||||
}
|
||||
MessageText.send(event.getTextChannel(), "The sqaure root of " + args[0] + " is **" + root + "**.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "The sqaure root of " + args[0] + " is **" + root + "**.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ public class SubtractCommand extends ClientCommand{
|
||||
if(end.equals(".0")) {
|
||||
sub = sub.replace(".0","");
|
||||
}
|
||||
MessageText.send(event.getTextChannel(), args[0] + " - " + args[1] + " is **" + sub + "**.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), args[0] + " - " + args[1] + " is **" + sub + "**.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,9 @@ 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;
|
||||
import net.dv8tion.jda.api.entities.Role;
|
||||
import net.dv8tion.jda.api.entities.emoji.Emoji;
|
||||
import net.dv8tion.jda.api.entities.emoji.EmojiUnion;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
|
||||
public class ToggleRoleCommand extends ClientCommand{
|
||||
@@ -38,7 +39,7 @@ public class ToggleRoleCommand extends ClientCommand{
|
||||
}
|
||||
|
||||
if(rolename.equals("")) {
|
||||
MessageText.send(event.getTextChannel(), "Sorry! This role either cannot be toggled or does not exist!");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "Sorry! This role either cannot be toggled or does not exist!");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -53,8 +54,8 @@ public class ToggleRoleCommand extends ClientCommand{
|
||||
return;
|
||||
}
|
||||
|
||||
Emote done = null;
|
||||
for(Emote e : event.getGuild().getEmotes()) {
|
||||
Emoji done = null;
|
||||
for(Emoji e : event.getMessage().getMentions().getCustomEmojis()) {
|
||||
if(e.getName().contains(b.getProperties().getDoneEmote())) {
|
||||
done = e;
|
||||
}
|
||||
@@ -80,7 +81,8 @@ public class ToggleRoleCommand extends ClientCommand{
|
||||
if(foundEmote) {
|
||||
event.getMessage().addReaction(done).queue();
|
||||
}else {
|
||||
event.getMessage().addReaction("✔").queue();
|
||||
//event.getMessage().addReaction("✔").queue();
|
||||
event.getMessage().addReaction(Emoji.fromFormatted("U+2714")).queue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,10 +25,10 @@ public class UIDCommand extends ClientCommand{
|
||||
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()){
|
||||
for(Member m : event.getMessage().getMentions().getMembers()){
|
||||
User u = m.getUser();
|
||||
if(PermUtil.isMod(event.getMember())) {
|
||||
MessageText.send(event.getTextChannel(), u.getId());
|
||||
MessageText.send(event.getChannel().asTextChannel(), u.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,12 +25,12 @@ public class UnSoftMuteCommand extends ClientCommand{
|
||||
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()){
|
||||
for(Member m : event.getMessage().getMentions().getMembers()){
|
||||
User u = m.getUser();
|
||||
String s = u.getAsMention();
|
||||
if(event.getChannel().getName().equals("public-softmute-test") || (PermUtil.isMod(event.getMember()))) {
|
||||
b.getMessageStore().removeSoftmuted(u);
|
||||
MessageText.send(event.getTextChannel(), s + " is no longer soft-muted.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), s + " is no longer soft-muted.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,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())) {
|
||||
MessageText.send(event.getTextChannel(), "https://git.fpghoti.com/thmsdy/Biscuit/wiki");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "https://git.fpghoti.com/thmsdy/Biscuit/wiki");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ public class ClearCommand extends MusicClientCommand{
|
||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -clear");
|
||||
if(PermUtil.hasMusicControl(event.getMember())) {
|
||||
MessageText.send(event.getTextChannel(), "Cleared all upcoming songs from the queue.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "Cleared all upcoming songs from the queue.");
|
||||
b.getAudioScheduler().getQueue().clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,8 +26,8 @@ public class ClearUserSongsCommand extends MusicClientCommand{
|
||||
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.getTextChannel(), "Clearing all upcoming tracks added by **" + m.getEffectiveName() + "**.");
|
||||
for(Member m : event.getMessage().getMentions().getMembers()) {
|
||||
MessageText.send(event.getChannel().asTextChannel(), "Clearing all upcoming tracks added by **" + m.getEffectiveName() + "**.");
|
||||
b.getAudioScheduler().getQueue().removeUserTracks(m.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@ public class ForceSkipCommand extends MusicClientCommand{
|
||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -forceskip");
|
||||
if(PermUtil.hasMusicControl(event.getMember())) {
|
||||
MessageText.send(event.getTextChannel(), "Force skipping current song.");
|
||||
b.getAudioScheduler().skip(event.getTextChannel());
|
||||
MessageText.send(event.getChannel().asTextChannel(), "Force skipping current song.");
|
||||
b.getAudioScheduler().skip(event.getChannel().asTextChannel());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,9 +28,9 @@ public class ForceSkipToCommand extends MusicClientCommand{
|
||||
if(PermUtil.hasMusicControl(event.getMember())) {
|
||||
if(Util.isDigit(args[0])) {
|
||||
int place = Integer.parseInt(args[0]);
|
||||
MessageText.send(event.getTextChannel(), "Force skipping to queue position **" + place + "**.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "Force skipping to queue position **" + place + "**.");
|
||||
b.getAudioScheduler().getQueue().removeTracksBefore(place);
|
||||
b.getAudioScheduler().skip(event.getTextChannel());
|
||||
b.getAudioScheduler().skip(event.getChannel().asTextChannel());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,10 +25,10 @@ public class LoopMusicCommand extends MusicClientCommand{
|
||||
b.log(event.getAuthor().getName() + " issued a command: -loopmusic");
|
||||
if(PermUtil.hasMusicControl(event.getMember())) {
|
||||
if(!b.getAudioScheduler().isLooping()) {
|
||||
MessageText.send(event.getTextChannel(), "Setting all music to loop.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "Setting all music to loop.");
|
||||
b.getAudioScheduler().setLooping(true);
|
||||
}else {
|
||||
MessageText.send(event.getTextChannel(), "Disabling music looping.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "Disabling music looping.");
|
||||
b.getAudioScheduler().setLooping(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ public class MoveToCommand extends MusicClientCommand{
|
||||
if(Util.isDigit(args[0]) && Util.isDigit(args[1])) {
|
||||
int oldPlace = Integer.parseInt(args[0]);
|
||||
int newPlace = Integer.parseInt(args[1]);
|
||||
MessageText.send(event.getTextChannel(), "The specified track was moved." );
|
||||
MessageText.send(event.getChannel().asTextChannel(), "The specified track was moved." );
|
||||
b.getAudioScheduler().getQueue().moveToPlace(oldPlace, newPlace);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,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);
|
||||
MessageText.send(event.getTextChannel(), next);
|
||||
MessageText.send(event.getChannel().asTextChannel(), next);
|
||||
}else {
|
||||
MessageText.send(event.getTextChannel(), "No song is currently playing.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "No song is currently playing.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,9 +26,9 @@ public class PauseCommand extends MusicClientCommand{
|
||||
if(PermUtil.hasMusicControl(event.getMember())) {
|
||||
if(!b.getAudioPlayer().isPaused()) {
|
||||
b.getAudioPlayer().setPaused(true);
|
||||
MessageText.send(event.getTextChannel(), "Paused the current track.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "Paused the current track.");
|
||||
}else {
|
||||
MessageText.send(event.getTextChannel(), "The music player is already paused.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "The music player is already paused.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,8 @@ import com.fpghoti.biscuit.rest.MessageText;
|
||||
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.entities.channel.concrete.TextChannel;
|
||||
//import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
|
||||
public class PlayFirstCommand extends MusicClientCommand{
|
||||
@@ -33,7 +34,7 @@ public class PlayFirstCommand extends MusicClientCommand{
|
||||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
Guild guild = event.getGuild();
|
||||
Biscuit b = Biscuit.getBiscuit(guild);
|
||||
TextChannel tchannel = event.getTextChannel();
|
||||
TextChannel tchannel = event.getChannel().asTextChannel();
|
||||
|
||||
int searchArg = 0;
|
||||
boolean scSearch = false;
|
||||
|
||||
@@ -33,7 +33,7 @@ public class QueueCommand extends MusicClientCommand{
|
||||
if(Util.isDigit(args[0])) {
|
||||
pg = Integer.parseInt(args[0]);
|
||||
}else {
|
||||
MessageText.send(event.getTextChannel(), "Usage: ``" + usage + "``");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "Usage: ``" + usage + "``");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,15 +46,15 @@ public class QueueCommand extends MusicClientCommand{
|
||||
|
||||
if(queue.size() == 0) {
|
||||
if(biscuit.getAudioPlayer().getPlayingTrack() == null) {
|
||||
MessageText.send(event.getTextChannel(), "There is currently no song playing.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "There is currently no song playing.");
|
||||
}else {
|
||||
MessageText.send(event.getTextChannel(), "Nothing is queued to play after the current track.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "Nothing is queued to play after the current track.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
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:**");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "**Use " + Main.getMainBiscuit().getProperties().getCommandSignifier() + "queue [Page #] to navigate the different pages.**");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "[" + 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.getTextChannel(), msg);
|
||||
MessageText.send(event.getChannel().asTextChannel(), msg);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ public class RemoveCommand extends MusicClientCommand{
|
||||
if(PermUtil.hasMusicControl(event.getMember())) {
|
||||
if(Util.isDigit(args[0])) {
|
||||
int place = Integer.parseInt(args[0]);
|
||||
MessageText.send(event.getTextChannel(), "Removing track at position **" + place + "**.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "Removing track at position **" + place + "**.");
|
||||
b.getAudioScheduler().getQueue().removeTrack(place);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,9 +24,9 @@ public class ShuffleCommand extends MusicClientCommand{
|
||||
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.getTextChannel(), "All songs that you have added to the queue have been shuffled.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "All songs that you have added to the queue have been shuffled.");
|
||||
}else {
|
||||
MessageText.send(event.getTextChannel(), "No song is currently playing.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "No song is currently playing.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,9 +24,9 @@ public class SkipAllCommand extends MusicClientCommand{
|
||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -skipall");
|
||||
if(PermUtil.hasMusicControl(event.getMember())) {
|
||||
MessageText.send(event.getTextChannel(), "Force skipping all songs.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "Force skipping all songs.");
|
||||
b.getAudioScheduler().getQueue().clear();
|
||||
b.getAudioScheduler().skip(event.getTextChannel());
|
||||
b.getAudioScheduler().skip(event.getChannel().asTextChannel());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,10 +8,10 @@ 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.channel.concrete.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.AudioChannel;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
|
||||
public class SkipCommand extends MusicClientCommand{
|
||||
@@ -32,11 +32,11 @@ public class SkipCommand extends MusicClientCommand{
|
||||
Biscuit biscuit = Biscuit.getBiscuit(guild);
|
||||
biscuit.log(event.getAuthor().getName() + " issued a command: -skip");
|
||||
|
||||
TextChannel cmdChannel = event.getTextChannel();
|
||||
TextChannel cmdChannel = event.getChannel().asTextChannel();
|
||||
|
||||
//Bot is not connected to voice channel. Do nothing.
|
||||
if(!guild.getAudioManager().isConnected()) {
|
||||
MessageText.send(event.getTextChannel(), "The music player is not connected to a voice channel!");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "The music player is not connected to a voice channel!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,10 +27,10 @@ public class TogglePauseCommand extends MusicClientCommand{
|
||||
if(PermUtil.hasMusicControl(event.getMember())) {
|
||||
if(b.getAudioPlayer().isPaused()) {
|
||||
b.getAudioPlayer().setPaused(false);
|
||||
MessageText.send(event.getTextChannel(), "Unpaused the current track.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "Unpaused the current track.");
|
||||
}else {
|
||||
b.getAudioPlayer().setPaused(true);
|
||||
MessageText.send(event.getTextChannel(), "Paused the current track.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "Paused the current track.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,9 +27,9 @@ public class UnpauseCommand extends MusicClientCommand{
|
||||
if(PermUtil.hasMusicControl(event.getMember())) {
|
||||
if(b.getAudioPlayer().isPaused()) {
|
||||
b.getAudioPlayer().setPaused(false);
|
||||
MessageText.send(event.getTextChannel(), "Unpaused the current track.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "Unpaused the current track.");
|
||||
}else {
|
||||
MessageText.send(event.getTextChannel(), "The music player is not paused.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "The music player is not paused.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public class VolumeCommand extends MusicClientCommand{
|
||||
|
||||
if(args.length < 1) {
|
||||
b.log(event.getAuthor().getName() + " issued a command: -volume");
|
||||
MessageText.send(event.getTextChannel(), "The current volume is: **" + b.getAudioPlayer().getVolume() + "**.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "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.getTextChannel(), "The volume was set to **" + b.getAudioPlayer().getVolume() + "**.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "The volume was set to **" + b.getAudioPlayer().getVolume() + "**.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user