Use Bot#getConfig() instead of using a public static config & Add missing newline

This commit is contained in:
MichailiK
2019-10-25 19:48:41 +02:00
parent f17058a344
commit 0b4c6c9af1
34 changed files with 57 additions and 81 deletions
@@ -46,7 +46,6 @@ public class JMusicBot
public final static Permission[] RECOMMENDED_PERMS = new Permission[]{Permission.MESSAGE_READ, Permission.MESSAGE_WRITE, Permission.MESSAGE_HISTORY, Permission.MESSAGE_ADD_REACTION, public final static Permission[] RECOMMENDED_PERMS = new Permission[]{Permission.MESSAGE_READ, Permission.MESSAGE_WRITE, Permission.MESSAGE_HISTORY, Permission.MESSAGE_ADD_REACTION,
Permission.MESSAGE_EMBED_LINKS, Permission.MESSAGE_ATTACH_FILES, Permission.MESSAGE_MANAGE, Permission.MESSAGE_EXT_EMOJI, Permission.MESSAGE_EMBED_LINKS, Permission.MESSAGE_ATTACH_FILES, Permission.MESSAGE_MANAGE, Permission.MESSAGE_EXT_EMOJI,
Permission.MANAGE_CHANNEL, Permission.VOICE_CONNECT, Permission.VOICE_SPEAK, Permission.NICKNAME_CHANGE}; Permission.MANAGE_CHANNEL, Permission.VOICE_CONNECT, Permission.VOICE_SPEAK, Permission.NICKNAME_CHANGE};
public static BotConfig config;
/** /**
* @param args the command line arguments * @param args the command line arguments
*/ */
@@ -72,7 +71,7 @@ public class JMusicBot
String version = OtherUtil.checkVersion(prompt); String version = OtherUtil.checkVersion(prompt);
// load config // load config
config = new BotConfig(prompt); BotConfig config = new BotConfig(prompt);
config.load(); config.load();
if(!config.isValid()) if(!config.isValid())
return; return;
@@ -100,7 +99,7 @@ public class JMusicBot
.setGuildSettingsManager(settings) .setGuildSettingsManager(settings)
.addCommands(aboutCommand, .addCommands(aboutCommand,
new PingCommand(), new PingCommand(),
new SettingsCmd(), new SettingsCmd(bot),
new LyricsCmd(bot), new LyricsCmd(bot),
new NowplayingCmd(bot), new NowplayingCmd(bot),
@@ -123,17 +122,17 @@ public class JMusicBot
new StopCmd(bot), new StopCmd(bot),
new VolumeCmd(bot), new VolumeCmd(bot),
new SetdjCmd(), new SetdjCmd(bot),
new SettcCmd(), new SettcCmd(bot),
new SetvcCmd(), new SetvcCmd(bot),
new AutoplaylistCmd(bot), new AutoplaylistCmd(bot),
new DebugCmd(bot), new DebugCmd(bot),
new PlaylistCmd(bot), new PlaylistCmd(bot),
new SetavatarCmd(), new SetavatarCmd(bot),
new SetgameCmd(), new SetgameCmd(bot),
new SetnameCmd(), new SetnameCmd(bot),
new SetstatusCmd(), new SetstatusCmd(bot),
new ShutdownCmd(bot) new ShutdownCmd(bot)
); );
if(config.useEval()) if(config.useEval())
@@ -18,7 +18,7 @@ package com.jagrosh.jmusicbot.commands.admin;
import java.util.List; import java.util.List;
import com.jagrosh.jdautilities.command.CommandEvent; import com.jagrosh.jdautilities.command.CommandEvent;
import com.jagrosh.jdautilities.commons.utils.FinderUtil; import com.jagrosh.jdautilities.commons.utils.FinderUtil;
import com.jagrosh.jmusicbot.JMusicBot; import com.jagrosh.jmusicbot.Bot;
import com.jagrosh.jmusicbot.commands.AdminCommand; import com.jagrosh.jmusicbot.commands.AdminCommand;
import com.jagrosh.jmusicbot.settings.Settings; import com.jagrosh.jmusicbot.settings.Settings;
import com.jagrosh.jmusicbot.utils.FormatUtil; import com.jagrosh.jmusicbot.utils.FormatUtil;
@@ -30,12 +30,12 @@ import net.dv8tion.jda.core.entities.Role;
*/ */
public class SetdjCmd extends AdminCommand public class SetdjCmd extends AdminCommand
{ {
public SetdjCmd() public SetdjCmd(Bot bot)
{ {
this.name = "setdj"; this.name = "setdj";
this.help = "sets the DJ role for certain music commands"; this.help = "sets the DJ role for certain music commands";
this.arguments = "<rolename|NONE>"; this.arguments = "<rolename|NONE>";
this.aliases = JMusicBot.config.getAliases(this.name); this.aliases = bot.getConfig().getAliases(this.name);
} }
@Override @Override
@@ -18,7 +18,7 @@ package com.jagrosh.jmusicbot.commands.admin;
import java.util.List; import java.util.List;
import com.jagrosh.jdautilities.command.CommandEvent; import com.jagrosh.jdautilities.command.CommandEvent;
import com.jagrosh.jdautilities.commons.utils.FinderUtil; import com.jagrosh.jdautilities.commons.utils.FinderUtil;
import com.jagrosh.jmusicbot.JMusicBot; import com.jagrosh.jmusicbot.Bot;
import com.jagrosh.jmusicbot.commands.AdminCommand; import com.jagrosh.jmusicbot.commands.AdminCommand;
import com.jagrosh.jmusicbot.settings.Settings; import com.jagrosh.jmusicbot.settings.Settings;
import com.jagrosh.jmusicbot.utils.FormatUtil; import com.jagrosh.jmusicbot.utils.FormatUtil;
@@ -30,12 +30,12 @@ import net.dv8tion.jda.core.entities.TextChannel;
*/ */
public class SettcCmd extends AdminCommand public class SettcCmd extends AdminCommand
{ {
public SettcCmd() public SettcCmd(Bot bot)
{ {
this.name = "settc"; this.name = "settc";
this.help = "sets the text channel for music commands"; this.help = "sets the text channel for music commands";
this.arguments = "<channel|NONE>"; this.arguments = "<channel|NONE>";
this.aliases = JMusicBot.config.getAliases(this.name); this.aliases = bot.getConfig().getAliases(this.name);
} }
@Override @Override
@@ -18,7 +18,7 @@ package com.jagrosh.jmusicbot.commands.admin;
import java.util.List; import java.util.List;
import com.jagrosh.jdautilities.command.CommandEvent; import com.jagrosh.jdautilities.command.CommandEvent;
import com.jagrosh.jdautilities.commons.utils.FinderUtil; import com.jagrosh.jdautilities.commons.utils.FinderUtil;
import com.jagrosh.jmusicbot.JMusicBot; import com.jagrosh.jmusicbot.Bot;
import com.jagrosh.jmusicbot.commands.AdminCommand; import com.jagrosh.jmusicbot.commands.AdminCommand;
import com.jagrosh.jmusicbot.settings.Settings; import com.jagrosh.jmusicbot.settings.Settings;
import com.jagrosh.jmusicbot.utils.FormatUtil; import com.jagrosh.jmusicbot.utils.FormatUtil;
@@ -30,12 +30,12 @@ import net.dv8tion.jda.core.entities.VoiceChannel;
*/ */
public class SetvcCmd extends AdminCommand public class SetvcCmd extends AdminCommand
{ {
public SetvcCmd() public SetvcCmd(Bot bot)
{ {
this.name = "setvc"; this.name = "setvc";
this.help = "sets the voice channel for playing music"; this.help = "sets the voice channel for playing music";
this.arguments = "<channel|NONE>"; this.arguments = "<channel|NONE>";
this.aliases = JMusicBot.config.getAliases(this.name); this.aliases = bot.getConfig().getAliases(this.name);
} }
@Override @Override
@@ -19,7 +19,6 @@ import com.jagrosh.jdautilities.command.CommandEvent;
import com.jagrosh.jdautilities.commons.utils.FinderUtil; import com.jagrosh.jdautilities.commons.utils.FinderUtil;
import com.jagrosh.jdautilities.menu.OrderedMenu; import com.jagrosh.jdautilities.menu.OrderedMenu;
import com.jagrosh.jmusicbot.Bot; import com.jagrosh.jmusicbot.Bot;
import com.jagrosh.jmusicbot.JMusicBot;
import com.jagrosh.jmusicbot.audio.AudioHandler; import com.jagrosh.jmusicbot.audio.AudioHandler;
import com.jagrosh.jmusicbot.commands.DJCommand; import com.jagrosh.jmusicbot.commands.DJCommand;
import net.dv8tion.jda.core.Permission; import net.dv8tion.jda.core.Permission;
@@ -41,7 +40,7 @@ public class ForceRemoveCmd extends DJCommand
this.name = "forceremove"; this.name = "forceremove";
this.help = "removes all entries by a user from the queue"; this.help = "removes all entries by a user from the queue";
this.arguments = "<user>"; this.arguments = "<user>";
this.aliases = JMusicBot.config.getAliases(this.name); this.aliases = bot.getConfig().getAliases(this.name);
this.beListening = false; this.beListening = false;
this.bePlaying = true; this.bePlaying = true;
this.botPermissions = new Permission[]{Permission.MESSAGE_EMBED_LINKS}; this.botPermissions = new Permission[]{Permission.MESSAGE_EMBED_LINKS};
@@ -17,7 +17,6 @@ package com.jagrosh.jmusicbot.commands.dj;
import com.jagrosh.jdautilities.command.CommandEvent; import com.jagrosh.jdautilities.command.CommandEvent;
import com.jagrosh.jmusicbot.Bot; import com.jagrosh.jmusicbot.Bot;
import com.jagrosh.jmusicbot.JMusicBot;
import com.jagrosh.jmusicbot.audio.AudioHandler; import com.jagrosh.jmusicbot.audio.AudioHandler;
import com.jagrosh.jmusicbot.commands.DJCommand; import com.jagrosh.jmusicbot.commands.DJCommand;
import net.dv8tion.jda.core.entities.User; import net.dv8tion.jda.core.entities.User;
@@ -33,7 +32,7 @@ public class ForceskipCmd extends DJCommand
super(bot); super(bot);
this.name = "forceskip"; this.name = "forceskip";
this.help = "skips the current song"; this.help = "skips the current song";
this.aliases = JMusicBot.config.getAliases(this.name); this.aliases = bot.getConfig().getAliases(this.name);
this.bePlaying = true; this.bePlaying = true;
} }
@@ -3,7 +3,6 @@ package com.jagrosh.jmusicbot.commands.dj;
import com.jagrosh.jdautilities.command.CommandEvent; import com.jagrosh.jdautilities.command.CommandEvent;
import com.jagrosh.jmusicbot.Bot; import com.jagrosh.jmusicbot.Bot;
import com.jagrosh.jmusicbot.JMusicBot;
import com.jagrosh.jmusicbot.audio.AudioHandler; import com.jagrosh.jmusicbot.audio.AudioHandler;
import com.jagrosh.jmusicbot.audio.QueuedTrack; import com.jagrosh.jmusicbot.audio.QueuedTrack;
import com.jagrosh.jmusicbot.commands.DJCommand; import com.jagrosh.jmusicbot.commands.DJCommand;
@@ -21,7 +20,7 @@ public class MoveTrackCmd extends DJCommand
this.name = "movetrack"; this.name = "movetrack";
this.help = "move a track in the current queue to a different position"; this.help = "move a track in the current queue to a different position";
this.arguments = "<from> <to>"; this.arguments = "<from> <to>";
this.aliases = JMusicBot.config.getAliases(this.name); this.aliases = bot.getConfig().getAliases(this.name);
this.bePlaying = true; this.bePlaying = true;
} }
@@ -17,7 +17,6 @@ package com.jagrosh.jmusicbot.commands.dj;
import com.jagrosh.jdautilities.command.CommandEvent; import com.jagrosh.jdautilities.command.CommandEvent;
import com.jagrosh.jmusicbot.Bot; import com.jagrosh.jmusicbot.Bot;
import com.jagrosh.jmusicbot.JMusicBot;
import com.jagrosh.jmusicbot.audio.AudioHandler; import com.jagrosh.jmusicbot.audio.AudioHandler;
import com.jagrosh.jmusicbot.commands.DJCommand; import com.jagrosh.jmusicbot.commands.DJCommand;
@@ -32,7 +31,7 @@ public class PauseCmd extends DJCommand
super(bot); super(bot);
this.name = "pause"; this.name = "pause";
this.help = "pauses the current song"; this.help = "pauses the current song";
this.aliases = JMusicBot.config.getAliases(this.name); this.aliases = bot.getConfig().getAliases(this.name);
this.bePlaying = true; this.bePlaying = true;
} }
@@ -17,7 +17,6 @@ package com.jagrosh.jmusicbot.commands.dj;
import com.jagrosh.jdautilities.command.CommandEvent; import com.jagrosh.jdautilities.command.CommandEvent;
import com.jagrosh.jmusicbot.Bot; import com.jagrosh.jmusicbot.Bot;
import com.jagrosh.jmusicbot.JMusicBot;
import com.jagrosh.jmusicbot.audio.AudioHandler; import com.jagrosh.jmusicbot.audio.AudioHandler;
import com.jagrosh.jmusicbot.audio.QueuedTrack; import com.jagrosh.jmusicbot.audio.QueuedTrack;
import com.jagrosh.jmusicbot.commands.DJCommand; import com.jagrosh.jmusicbot.commands.DJCommand;
@@ -43,7 +42,7 @@ public class PlaynextCmd extends DJCommand
this.name = "playnext"; this.name = "playnext";
this.arguments = "<title|URL>"; this.arguments = "<title|URL>";
this.help = "plays a single song next"; this.help = "plays a single song next";
this.aliases = JMusicBot.config.getAliases(this.name); this.aliases = bot.getConfig().getAliases(this.name);
this.beListening = true; this.beListening = true;
this.bePlaying = false; this.bePlaying = false;
} }
@@ -17,7 +17,6 @@ package com.jagrosh.jmusicbot.commands.dj;
import com.jagrosh.jdautilities.command.CommandEvent; import com.jagrosh.jdautilities.command.CommandEvent;
import com.jagrosh.jmusicbot.Bot; import com.jagrosh.jmusicbot.Bot;
import com.jagrosh.jmusicbot.JMusicBot;
import com.jagrosh.jmusicbot.commands.DJCommand; import com.jagrosh.jmusicbot.commands.DJCommand;
import com.jagrosh.jmusicbot.settings.Settings; import com.jagrosh.jmusicbot.settings.Settings;
@@ -33,7 +32,7 @@ public class RepeatCmd extends DJCommand
this.name = "repeat"; this.name = "repeat";
this.help = "re-adds music to the queue when finished"; this.help = "re-adds music to the queue when finished";
this.arguments = "[on|off]"; this.arguments = "[on|off]";
this.aliases = JMusicBot.config.getAliases(this.name); this.aliases = bot.getConfig().getAliases(this.name);
this.guildOnly = true; this.guildOnly = true;
} }
@@ -17,7 +17,6 @@ package com.jagrosh.jmusicbot.commands.dj;
import com.jagrosh.jdautilities.command.CommandEvent; import com.jagrosh.jdautilities.command.CommandEvent;
import com.jagrosh.jmusicbot.Bot; import com.jagrosh.jmusicbot.Bot;
import com.jagrosh.jmusicbot.JMusicBot;
import com.jagrosh.jmusicbot.audio.AudioHandler; import com.jagrosh.jmusicbot.audio.AudioHandler;
import com.jagrosh.jmusicbot.commands.DJCommand; import com.jagrosh.jmusicbot.commands.DJCommand;
@@ -33,7 +32,7 @@ public class SkiptoCmd extends DJCommand
this.name = "skipto"; this.name = "skipto";
this.help = "skips to the specified song"; this.help = "skips to the specified song";
this.arguments = "<position>"; this.arguments = "<position>";
this.aliases = JMusicBot.config.getAliases(this.name); this.aliases = bot.getConfig().getAliases(this.name);
this.bePlaying = true; this.bePlaying = true;
} }
@@ -17,7 +17,6 @@ package com.jagrosh.jmusicbot.commands.dj;
import com.jagrosh.jdautilities.command.CommandEvent; import com.jagrosh.jdautilities.command.CommandEvent;
import com.jagrosh.jmusicbot.Bot; import com.jagrosh.jmusicbot.Bot;
import com.jagrosh.jmusicbot.JMusicBot;
import com.jagrosh.jmusicbot.audio.AudioHandler; import com.jagrosh.jmusicbot.audio.AudioHandler;
import com.jagrosh.jmusicbot.commands.DJCommand; import com.jagrosh.jmusicbot.commands.DJCommand;
@@ -32,7 +31,7 @@ public class StopCmd extends DJCommand
super(bot); super(bot);
this.name = "stop"; this.name = "stop";
this.help = "stops the current song and clears the queue"; this.help = "stops the current song and clears the queue";
this.aliases = JMusicBot.config.getAliases(this.name); this.aliases = bot.getConfig().getAliases(this.name);
this.bePlaying = false; this.bePlaying = false;
} }
@@ -17,7 +17,6 @@ package com.jagrosh.jmusicbot.commands.dj;
import com.jagrosh.jdautilities.command.CommandEvent; import com.jagrosh.jdautilities.command.CommandEvent;
import com.jagrosh.jmusicbot.Bot; import com.jagrosh.jmusicbot.Bot;
import com.jagrosh.jmusicbot.JMusicBot;
import com.jagrosh.jmusicbot.audio.AudioHandler; import com.jagrosh.jmusicbot.audio.AudioHandler;
import com.jagrosh.jmusicbot.commands.DJCommand; import com.jagrosh.jmusicbot.commands.DJCommand;
import com.jagrosh.jmusicbot.settings.Settings; import com.jagrosh.jmusicbot.settings.Settings;
@@ -33,7 +32,7 @@ public class VolumeCmd extends DJCommand
{ {
super(bot); super(bot);
this.name = "volume"; this.name = "volume";
this.aliases = JMusicBot.config.getAliases(this.name); this.aliases = bot.getConfig().getAliases(this.name);
this.help = "sets or shows volume"; this.help = "sets or shows volume";
this.arguments = "[0-150]"; this.arguments = "[0-150]";
} }
@@ -17,7 +17,7 @@ package com.jagrosh.jmusicbot.commands.general;
import com.jagrosh.jdautilities.command.Command; import com.jagrosh.jdautilities.command.Command;
import com.jagrosh.jdautilities.command.CommandEvent; import com.jagrosh.jdautilities.command.CommandEvent;
import com.jagrosh.jmusicbot.JMusicBot; import com.jagrosh.jmusicbot.Bot;
import com.jagrosh.jmusicbot.settings.Settings; import com.jagrosh.jmusicbot.settings.Settings;
import net.dv8tion.jda.core.EmbedBuilder; import net.dv8tion.jda.core.EmbedBuilder;
import net.dv8tion.jda.core.MessageBuilder; import net.dv8tion.jda.core.MessageBuilder;
@@ -33,11 +33,11 @@ public class SettingsCmd extends Command
{ {
private final static String EMOJI = "\uD83C\uDFA7"; // 🎧 private final static String EMOJI = "\uD83C\uDFA7"; // 🎧
public SettingsCmd() public SettingsCmd(Bot bot)
{ {
this.name = "settings"; this.name = "settings";
this.help = "shows the bots settings"; this.help = "shows the bots settings";
this.aliases = JMusicBot.config.getAliases(this.name); this.aliases = bot.getConfig().getAliases(this.name);
this.guildOnly = true; this.guildOnly = true;
} }
@@ -19,7 +19,6 @@ import com.jagrosh.jdautilities.command.CommandEvent;
import com.jagrosh.jlyrics.Lyrics; import com.jagrosh.jlyrics.Lyrics;
import com.jagrosh.jlyrics.LyricsClient; import com.jagrosh.jlyrics.LyricsClient;
import com.jagrosh.jmusicbot.Bot; import com.jagrosh.jmusicbot.Bot;
import com.jagrosh.jmusicbot.JMusicBot;
import com.jagrosh.jmusicbot.audio.AudioHandler; import com.jagrosh.jmusicbot.audio.AudioHandler;
import com.jagrosh.jmusicbot.commands.MusicCommand; import com.jagrosh.jmusicbot.commands.MusicCommand;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
@@ -40,7 +39,7 @@ public class LyricsCmd extends MusicCommand
this.name = "lyrics"; this.name = "lyrics";
this.arguments = "[song name]"; this.arguments = "[song name]";
this.help = "shows the lyrics to the currently-playing song"; this.help = "shows the lyrics to the currently-playing song";
this.aliases = JMusicBot.config.getAliases(this.name); this.aliases = bot.getConfig().getAliases(this.name);
this.botPermissions = new Permission[]{Permission.MESSAGE_EMBED_LINKS}; this.botPermissions = new Permission[]{Permission.MESSAGE_EMBED_LINKS};
this.bePlaying = true; this.bePlaying = true;
} }
@@ -17,7 +17,6 @@ package com.jagrosh.jmusicbot.commands.music;
import com.jagrosh.jdautilities.command.CommandEvent; import com.jagrosh.jdautilities.command.CommandEvent;
import com.jagrosh.jmusicbot.Bot; import com.jagrosh.jmusicbot.Bot;
import com.jagrosh.jmusicbot.JMusicBot;
import com.jagrosh.jmusicbot.audio.AudioHandler; import com.jagrosh.jmusicbot.audio.AudioHandler;
import com.jagrosh.jmusicbot.commands.MusicCommand; import com.jagrosh.jmusicbot.commands.MusicCommand;
import net.dv8tion.jda.core.Permission; import net.dv8tion.jda.core.Permission;
@@ -34,7 +33,7 @@ public class NowplayingCmd extends MusicCommand
super(bot); super(bot);
this.name = "nowplaying"; this.name = "nowplaying";
this.help = "shows the song that is currently playing"; this.help = "shows the song that is currently playing";
this.aliases = JMusicBot.config.getAliases(this.name); this.aliases = bot.getConfig().getAliases(this.name);
this.botPermissions = new Permission[]{Permission.MESSAGE_EMBED_LINKS}; this.botPermissions = new Permission[]{Permission.MESSAGE_EMBED_LINKS};
} }
@@ -15,7 +15,6 @@
*/ */
package com.jagrosh.jmusicbot.commands.music; package com.jagrosh.jmusicbot.commands.music;
import com.jagrosh.jmusicbot.JMusicBot;
import com.sedmelluq.discord.lavaplayer.player.AudioLoadResultHandler; import com.sedmelluq.discord.lavaplayer.player.AudioLoadResultHandler;
import com.sedmelluq.discord.lavaplayer.tools.FriendlyException; import com.sedmelluq.discord.lavaplayer.tools.FriendlyException;
import com.sedmelluq.discord.lavaplayer.tools.FriendlyException.Severity; import com.sedmelluq.discord.lavaplayer.tools.FriendlyException.Severity;
@@ -54,7 +53,7 @@ public class PlayCmd extends MusicCommand
this.name = "play"; this.name = "play";
this.arguments = "<title|URL|subcommand>"; this.arguments = "<title|URL|subcommand>";
this.help = "plays the provided song"; this.help = "plays the provided song";
this.aliases = JMusicBot.config.getAliases(this.name); this.aliases = bot.getConfig().getAliases(this.name);
this.beListening = true; this.beListening = true;
this.bePlaying = false; this.bePlaying = false;
this.children = new Command[]{new PlaylistCmd(bot)}; this.children = new Command[]{new PlaylistCmd(bot)};
@@ -18,7 +18,6 @@ package com.jagrosh.jmusicbot.commands.music;
import java.util.List; import java.util.List;
import com.jagrosh.jdautilities.command.CommandEvent; import com.jagrosh.jdautilities.command.CommandEvent;
import com.jagrosh.jmusicbot.Bot; import com.jagrosh.jmusicbot.Bot;
import com.jagrosh.jmusicbot.JMusicBot;
import com.jagrosh.jmusicbot.commands.MusicCommand; import com.jagrosh.jmusicbot.commands.MusicCommand;
/** /**
@@ -32,7 +31,7 @@ public class PlaylistsCmd extends MusicCommand
super(bot); super(bot);
this.name = "playlists"; this.name = "playlists";
this.help = "shows the available playlists"; this.help = "shows the available playlists";
this.aliases = JMusicBot.config.getAliases(this.name); this.aliases = bot.getConfig().getAliases(this.name);
this.guildOnly = true; this.guildOnly = true;
this.beListening = false; this.beListening = false;
this.beListening = false; this.beListening = false;
@@ -47,7 +47,7 @@ public class QueueCmd extends MusicCommand
this.name = "queue"; this.name = "queue";
this.help = "shows the current queue"; this.help = "shows the current queue";
this.arguments = "[pagenum]"; this.arguments = "[pagenum]";
this.aliases = JMusicBot.config.getAliases(this.name); this.aliases = bot.getConfig().getAliases(this.name);
this.bePlaying = true; this.bePlaying = true;
this.botPermissions = new Permission[]{Permission.MESSAGE_ADD_REACTION,Permission.MESSAGE_EMBED_LINKS}; this.botPermissions = new Permission[]{Permission.MESSAGE_ADD_REACTION,Permission.MESSAGE_EMBED_LINKS};
builder = new Paginator.Builder() builder = new Paginator.Builder()
@@ -17,7 +17,6 @@ package com.jagrosh.jmusicbot.commands.music;
import com.jagrosh.jdautilities.command.CommandEvent; import com.jagrosh.jdautilities.command.CommandEvent;
import com.jagrosh.jmusicbot.Bot; import com.jagrosh.jmusicbot.Bot;
import com.jagrosh.jmusicbot.JMusicBot;
import com.jagrosh.jmusicbot.audio.AudioHandler; import com.jagrosh.jmusicbot.audio.AudioHandler;
import com.jagrosh.jmusicbot.audio.QueuedTrack; import com.jagrosh.jmusicbot.audio.QueuedTrack;
import com.jagrosh.jmusicbot.commands.MusicCommand; import com.jagrosh.jmusicbot.commands.MusicCommand;
@@ -37,7 +36,7 @@ public class RemoveCmd extends MusicCommand
this.name = "remove"; this.name = "remove";
this.help = "removes a song from the queue"; this.help = "removes a song from the queue";
this.arguments = "<position|ALL>"; this.arguments = "<position|ALL>";
this.aliases = JMusicBot.config.getAliases(this.name); this.aliases = bot.getConfig().getAliases(this.name);
this.beListening = true; this.beListening = true;
this.bePlaying = true; this.bePlaying = true;
} }
@@ -30,6 +30,6 @@ public class SCSearchCmd extends SearchCmd
this.searchPrefix = "scsearch:"; this.searchPrefix = "scsearch:";
this.name = "scsearch"; this.name = "scsearch";
this.help = "searches Soundcloud for a provided query"; this.help = "searches Soundcloud for a provided query";
this.aliases = JMusicBot.config.getAliases(this.name); this.aliases = bot.getConfig().getAliases(this.name);
} }
} }
@@ -15,7 +15,6 @@
*/ */
package com.jagrosh.jmusicbot.commands.music; package com.jagrosh.jmusicbot.commands.music;
import com.jagrosh.jmusicbot.JMusicBot;
import com.sedmelluq.discord.lavaplayer.player.AudioLoadResultHandler; import com.sedmelluq.discord.lavaplayer.player.AudioLoadResultHandler;
import com.sedmelluq.discord.lavaplayer.tools.FriendlyException; import com.sedmelluq.discord.lavaplayer.tools.FriendlyException;
import com.sedmelluq.discord.lavaplayer.tools.FriendlyException.Severity; import com.sedmelluq.discord.lavaplayer.tools.FriendlyException.Severity;
@@ -47,7 +46,7 @@ public class SearchCmd extends MusicCommand
super(bot); super(bot);
this.searchingEmoji = bot.getConfig().getSearching(); this.searchingEmoji = bot.getConfig().getSearching();
this.name = "search"; this.name = "search";
this.aliases = JMusicBot.config.getAliases(this.name); this.aliases = bot.getConfig().getAliases(this.name);
this.arguments = "<query>"; this.arguments = "<query>";
this.help = "searches Youtube for a provided query"; this.help = "searches Youtube for a provided query";
this.beListening = true; this.beListening = true;
@@ -17,7 +17,6 @@ package com.jagrosh.jmusicbot.commands.music;
import com.jagrosh.jdautilities.command.CommandEvent; import com.jagrosh.jdautilities.command.CommandEvent;
import com.jagrosh.jmusicbot.Bot; import com.jagrosh.jmusicbot.Bot;
import com.jagrosh.jmusicbot.JMusicBot;
import com.jagrosh.jmusicbot.audio.AudioHandler; import com.jagrosh.jmusicbot.audio.AudioHandler;
import com.jagrosh.jmusicbot.commands.MusicCommand; import com.jagrosh.jmusicbot.commands.MusicCommand;
@@ -32,7 +31,7 @@ public class ShuffleCmd extends MusicCommand
super(bot); super(bot);
this.name = "shuffle"; this.name = "shuffle";
this.help = "shuffles songs you have added"; this.help = "shuffles songs you have added";
this.aliases = JMusicBot.config.getAliases(this.name); this.aliases = bot.getConfig().getAliases(this.name);
this.beListening = true; this.beListening = true;
this.bePlaying = true; this.bePlaying = true;
} }
@@ -17,7 +17,6 @@ package com.jagrosh.jmusicbot.commands.music;
import com.jagrosh.jdautilities.command.CommandEvent; import com.jagrosh.jdautilities.command.CommandEvent;
import com.jagrosh.jmusicbot.Bot; import com.jagrosh.jmusicbot.Bot;
import com.jagrosh.jmusicbot.JMusicBot;
import com.jagrosh.jmusicbot.audio.AudioHandler; import com.jagrosh.jmusicbot.audio.AudioHandler;
import com.jagrosh.jmusicbot.commands.MusicCommand; import com.jagrosh.jmusicbot.commands.MusicCommand;
import net.dv8tion.jda.core.entities.User; import net.dv8tion.jda.core.entities.User;
@@ -33,7 +32,7 @@ public class SkipCmd extends MusicCommand
super(bot); super(bot);
this.name = "skip"; this.name = "skip";
this.help = "votes to skip the current song"; this.help = "votes to skip the current song";
this.aliases = JMusicBot.config.getAliases(this.name); this.aliases = bot.getConfig().getAliases(this.name);
this.beListening = true; this.beListening = true;
this.bePlaying = true; this.bePlaying = true;
} }
@@ -17,7 +17,6 @@ package com.jagrosh.jmusicbot.commands.owner;
import com.jagrosh.jdautilities.command.CommandEvent; import com.jagrosh.jdautilities.command.CommandEvent;
import com.jagrosh.jmusicbot.Bot; import com.jagrosh.jmusicbot.Bot;
import com.jagrosh.jmusicbot.JMusicBot;
import com.jagrosh.jmusicbot.commands.OwnerCommand; import com.jagrosh.jmusicbot.commands.OwnerCommand;
import com.jagrosh.jmusicbot.settings.Settings; import com.jagrosh.jmusicbot.settings.Settings;
@@ -36,7 +35,7 @@ public class AutoplaylistCmd extends OwnerCommand
this.name = "autoplaylist"; this.name = "autoplaylist";
this.arguments = "<name|NONE>"; this.arguments = "<name|NONE>";
this.help = "sets the default playlist for the server"; this.help = "sets the default playlist for the server";
this.aliases = JMusicBot.config.getAliases(this.name); this.aliases = bot.getConfig().getAliases(this.name);
} }
@Override @Override
@@ -18,7 +18,6 @@ package com.jagrosh.jmusicbot.commands.owner;
import com.jagrosh.jdautilities.command.CommandEvent; import com.jagrosh.jdautilities.command.CommandEvent;
import com.jagrosh.jdautilities.commons.JDAUtilitiesInfo; import com.jagrosh.jdautilities.commons.JDAUtilitiesInfo;
import com.jagrosh.jmusicbot.Bot; import com.jagrosh.jmusicbot.Bot;
import com.jagrosh.jmusicbot.JMusicBot;
import com.jagrosh.jmusicbot.commands.OwnerCommand; import com.jagrosh.jmusicbot.commands.OwnerCommand;
import com.jagrosh.jmusicbot.utils.OtherUtil; import com.jagrosh.jmusicbot.utils.OtherUtil;
import com.sedmelluq.discord.lavaplayer.tools.PlayerLibrary; import com.sedmelluq.discord.lavaplayer.tools.PlayerLibrary;
@@ -42,7 +41,7 @@ public class DebugCmd extends OwnerCommand
this.bot = bot; this.bot = bot;
this.name = "debug"; this.name = "debug";
this.help = "shows debug info"; this.help = "shows debug info";
this.aliases = JMusicBot.config.getAliases(this.name); this.aliases = bot.getConfig().getAliases(this.name);
this.guildOnly = false; this.guildOnly = false;
} }
@@ -19,7 +19,6 @@ import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager; import javax.script.ScriptEngineManager;
import com.jagrosh.jdautilities.command.CommandEvent; import com.jagrosh.jdautilities.command.CommandEvent;
import com.jagrosh.jmusicbot.Bot; import com.jagrosh.jmusicbot.Bot;
import com.jagrosh.jmusicbot.JMusicBot;
import com.jagrosh.jmusicbot.commands.OwnerCommand; import com.jagrosh.jmusicbot.commands.OwnerCommand;
/** /**
@@ -35,7 +34,7 @@ public class EvalCmd extends OwnerCommand
this.bot = bot; this.bot = bot;
this.name = "eval"; this.name = "eval";
this.help = "evaluates nashorn code"; this.help = "evaluates nashorn code";
this.aliases = JMusicBot.config.getAliases(this.name); this.aliases = bot.getConfig().getAliases(this.name);
this.guildOnly = false; this.guildOnly = false;
} }
@@ -20,9 +20,7 @@ import java.util.List;
import com.jagrosh.jdautilities.command.Command; import com.jagrosh.jdautilities.command.Command;
import com.jagrosh.jdautilities.command.CommandEvent; import com.jagrosh.jdautilities.command.CommandEvent;
import com.jagrosh.jmusicbot.Bot; import com.jagrosh.jmusicbot.Bot;
import com.jagrosh.jmusicbot.JMusicBot;
import com.jagrosh.jmusicbot.commands.OwnerCommand; import com.jagrosh.jmusicbot.commands.OwnerCommand;
import com.jagrosh.jmusicbot.commands.owner.AutoplaylistCmd;
import com.jagrosh.jmusicbot.playlist.PlaylistLoader.Playlist; import com.jagrosh.jmusicbot.playlist.PlaylistLoader.Playlist;
/** /**
@@ -39,7 +37,7 @@ public class PlaylistCmd extends OwnerCommand
this.name = "playlist"; this.name = "playlist";
this.arguments = "<append|delete|make|setdefault>"; this.arguments = "<append|delete|make|setdefault>";
this.help = "playlist management"; this.help = "playlist management";
this.aliases = JMusicBot.config.getAliases(this.name); this.aliases = bot.getConfig().getAliases(this.name);
this.children = new OwnerCommand[]{ this.children = new OwnerCommand[]{
new ListCmd(), new ListCmd(),
new AppendlistCmd(), new AppendlistCmd(),
@@ -18,7 +18,7 @@ package com.jagrosh.jmusicbot.commands.owner;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import com.jagrosh.jdautilities.command.CommandEvent; import com.jagrosh.jdautilities.command.CommandEvent;
import com.jagrosh.jmusicbot.JMusicBot; import com.jagrosh.jmusicbot.Bot;
import com.jagrosh.jmusicbot.commands.OwnerCommand; import com.jagrosh.jmusicbot.commands.OwnerCommand;
import com.jagrosh.jmusicbot.utils.OtherUtil; import com.jagrosh.jmusicbot.utils.OtherUtil;
import net.dv8tion.jda.core.entities.Icon; import net.dv8tion.jda.core.entities.Icon;
@@ -29,12 +29,12 @@ import net.dv8tion.jda.core.entities.Icon;
*/ */
public class SetavatarCmd extends OwnerCommand public class SetavatarCmd extends OwnerCommand
{ {
public SetavatarCmd() public SetavatarCmd(Bot bot)
{ {
this.name = "setavatar"; this.name = "setavatar";
this.help = "sets the avatar of the bot"; this.help = "sets the avatar of the bot";
this.arguments = "<url>"; this.arguments = "<url>";
this.aliases = JMusicBot.config.getAliases(this.name); this.aliases = bot.getConfig().getAliases(this.name);
this.guildOnly = false; this.guildOnly = false;
} }
@@ -16,7 +16,7 @@
package com.jagrosh.jmusicbot.commands.owner; package com.jagrosh.jmusicbot.commands.owner;
import com.jagrosh.jdautilities.command.CommandEvent; import com.jagrosh.jdautilities.command.CommandEvent;
import com.jagrosh.jmusicbot.JMusicBot; import com.jagrosh.jmusicbot.Bot;
import com.jagrosh.jmusicbot.commands.OwnerCommand; import com.jagrosh.jmusicbot.commands.OwnerCommand;
import net.dv8tion.jda.core.entities.Game; import net.dv8tion.jda.core.entities.Game;
@@ -26,12 +26,12 @@ import net.dv8tion.jda.core.entities.Game;
*/ */
public class SetgameCmd extends OwnerCommand public class SetgameCmd extends OwnerCommand
{ {
public SetgameCmd() public SetgameCmd(Bot bot)
{ {
this.name = "setgame"; this.name = "setgame";
this.help = "sets the game the bot is playing"; this.help = "sets the game the bot is playing";
this.arguments = "[action] [game]"; this.arguments = "[action] [game]";
this.aliases = JMusicBot.config.getAliases(this.name); this.aliases = bot.getConfig().getAliases(this.name);
this.guildOnly = false; this.guildOnly = false;
this.children = new OwnerCommand[]{ this.children = new OwnerCommand[]{
new SetlistenCmd(), new SetlistenCmd(),
@@ -17,7 +17,6 @@ package com.jagrosh.jmusicbot.commands.owner;
import com.jagrosh.jdautilities.command.CommandEvent; import com.jagrosh.jdautilities.command.CommandEvent;
import com.jagrosh.jmusicbot.Bot; import com.jagrosh.jmusicbot.Bot;
import com.jagrosh.jmusicbot.JMusicBot;
import com.jagrosh.jmusicbot.commands.OwnerCommand; import com.jagrosh.jmusicbot.commands.OwnerCommand;
import net.dv8tion.jda.core.exceptions.RateLimitedException; import net.dv8tion.jda.core.exceptions.RateLimitedException;
@@ -27,12 +26,12 @@ import net.dv8tion.jda.core.exceptions.RateLimitedException;
*/ */
public class SetnameCmd extends OwnerCommand public class SetnameCmd extends OwnerCommand
{ {
public SetnameCmd() public SetnameCmd(Bot bot)
{ {
this.name = "setname"; this.name = "setname";
this.help = "sets the name of the bot"; this.help = "sets the name of the bot";
this.arguments = "<name>"; this.arguments = "<name>";
this.aliases = JMusicBot.config.getAliases(this.name); this.aliases = bot.getConfig().getAliases(this.name);
this.guildOnly = false; this.guildOnly = false;
} }
@@ -16,7 +16,7 @@
package com.jagrosh.jmusicbot.commands.owner; package com.jagrosh.jmusicbot.commands.owner;
import com.jagrosh.jdautilities.command.CommandEvent; import com.jagrosh.jdautilities.command.CommandEvent;
import com.jagrosh.jmusicbot.JMusicBot; import com.jagrosh.jmusicbot.Bot;
import com.jagrosh.jmusicbot.commands.OwnerCommand; import com.jagrosh.jmusicbot.commands.OwnerCommand;
import net.dv8tion.jda.core.OnlineStatus; import net.dv8tion.jda.core.OnlineStatus;
@@ -26,12 +26,12 @@ import net.dv8tion.jda.core.OnlineStatus;
*/ */
public class SetstatusCmd extends OwnerCommand public class SetstatusCmd extends OwnerCommand
{ {
public SetstatusCmd() public SetstatusCmd(Bot bot)
{ {
this.name = "setstatus"; this.name = "setstatus";
this.help = "sets the status the bot displays"; this.help = "sets the status the bot displays";
this.arguments = "<status>"; this.arguments = "<status>";
this.aliases = JMusicBot.config.getAliases(this.name); this.aliases = bot.getConfig().getAliases(this.name);
this.guildOnly = false; this.guildOnly = false;
} }
@@ -17,7 +17,6 @@ package com.jagrosh.jmusicbot.commands.owner;
import com.jagrosh.jdautilities.command.CommandEvent; import com.jagrosh.jdautilities.command.CommandEvent;
import com.jagrosh.jmusicbot.Bot; import com.jagrosh.jmusicbot.Bot;
import com.jagrosh.jmusicbot.JMusicBot;
import com.jagrosh.jmusicbot.commands.OwnerCommand; import com.jagrosh.jmusicbot.commands.OwnerCommand;
/** /**
@@ -33,7 +32,7 @@ public class ShutdownCmd extends OwnerCommand
this.bot = bot; this.bot = bot;
this.name = "shutdown"; this.name = "shutdown";
this.help = "safely shuts down"; this.help = "safely shuts down";
this.aliases = JMusicBot.config.getAliases(this.name); this.aliases = bot.getConfig().getAliases(this.name);
this.guildOnly = false; this.guildOnly = false;
} }
+1
View File
@@ -152,6 +152,7 @@ aliases {
shuffle = [] shuffle = []
skip = [ voteskip ] skip = [ voteskip ]
// Admin commands // Admin commands
setdj = [] setdj = []