renamed a couple of things
This commit is contained in:
1 parent
5f1cbad0ee
commit
6f5451f37d
16 files changed
+31
-34
No files matched your search
+2
-1
@@ -3,6 +3,7 @@ version: '3.3'
|
||||
services:
|
||||
db:
|
||||
image: mariadb:10.7
|
||||
container_name: db
|
||||
restart: always
|
||||
volumes:
|
||||
- netneutrality-db:/var/lib/mysql
|
||||
@@ -18,7 +19,7 @@ services:
|
||||
- internal
|
||||
|
||||
bot:
|
||||
image: netneutrality:dev
|
||||
container_name: bot
|
||||
build: ./
|
||||
restart: always
|
||||
depends_on:
|
||||
|
||||
@@ -59,15 +59,15 @@ public class HelpCommand extends AbstractCommand {
|
||||
|
||||
@Override
|
||||
public void execute(CommandContext context) {
|
||||
if (context.getArgumentsAsArray().length == 0) {
|
||||
if (context.getArgs().length == 0) {
|
||||
List<MessageEmbed> help = MessageFunction.buildHelpMessage(CommandManager.commands, UserFunction.isAdmin(context.getGuildUser()));
|
||||
|
||||
context.reply(new MessageBuilder().append(context.getDiscordUser()).append(" help has been sent your way!").build());
|
||||
context.replyPrivate(help);
|
||||
}
|
||||
|
||||
if (context.getArgumentsAsArray().length == 1) {
|
||||
String cmd = context.getArg(0);
|
||||
if (context.getArgs().length == 1) {
|
||||
String cmd = context.getArgument(0);
|
||||
|
||||
if (CommandManager.commands.containsKey(cmd) || CommandManager.commandsAlias.containsKey(cmd)) {
|
||||
AbstractCommand c = CommandManager.commands.containsKey(cmd) ? CommandManager.commands.get(cmd) : CommandManager.commandsAlias.get(cmd);
|
||||
|
||||
@@ -50,7 +50,7 @@ public class PingCommand extends AbstractCommand {
|
||||
|
||||
@Override
|
||||
public void execute(CommandContext context) {
|
||||
if (context.getArgumentsAsArray().length == 0)
|
||||
if (context.getArgs().length == 0)
|
||||
context.reply(String.format("Pong! [%d ms]", context.getJDA().getGatewayPing()));
|
||||
}
|
||||
|
||||
|
||||
@@ -57,13 +57,13 @@ public class ConfigureCommand extends AbstractCommand {
|
||||
|
||||
@Override
|
||||
public void execute(CommandContext context) {
|
||||
String[] args = context.getArgumentsAsArray();
|
||||
String[] args = context.getArgs();
|
||||
GuildManager guildManager = GuildManager.getManager(context.getGuild());
|
||||
|
||||
if (args.length > 0) {
|
||||
|
||||
// Role for music commands
|
||||
if (context.getArg(0).equals("music-role")) {
|
||||
if (context.getArgument(0).equals("music-role")) {
|
||||
if (args.length == 1) {
|
||||
String roleDb = guildManager.getSetting(GuildManager.Settings.MUSIC_ROLE);
|
||||
Role role = null;
|
||||
@@ -76,7 +76,7 @@ public class ConfigureCommand extends AbstractCommand {
|
||||
}
|
||||
|
||||
if (args.length == 2) {
|
||||
if (context.getArg(1).equals("reset")) {
|
||||
if (context.getArgument(1).equals("reset")) {
|
||||
if (!guildManager.getSetting(GuildManager.Settings.MUSIC_ROLE).isEmpty()) {
|
||||
guildManager.setSettingValue(GuildManager.Settings.MUSIC_ROLE, null);
|
||||
}
|
||||
@@ -96,7 +96,7 @@ public class ConfigureCommand extends AbstractCommand {
|
||||
}
|
||||
|
||||
// Role for music commands
|
||||
if (context.getArg(0).equals("music-channel")) {
|
||||
if (context.getArgument(0).equals("music-channel")) {
|
||||
if (args.length == 1) {
|
||||
String channelDb = guildManager.getSetting(GuildManager.Settings.MUSIC_CHANNEL);
|
||||
TextChannel channel = null;
|
||||
@@ -109,7 +109,7 @@ public class ConfigureCommand extends AbstractCommand {
|
||||
}
|
||||
|
||||
if (args.length == 2) {
|
||||
if (context.getArg(1).equals("reset")) {
|
||||
if (context.getArgument(1).equals("reset")) {
|
||||
if (!guildManager.getSetting(GuildManager.Settings.MUSIC_CHANNEL).isEmpty()) {
|
||||
guildManager.setSettingValue(GuildManager.Settings.MUSIC_CHANNEL, null);
|
||||
}
|
||||
@@ -129,7 +129,7 @@ public class ConfigureCommand extends AbstractCommand {
|
||||
}
|
||||
|
||||
// Default volume for music player
|
||||
if (context.getArg(0).equals("music-volume")) {
|
||||
if (context.getArgument(0).equals("music-volume")) {
|
||||
if (args.length == 1) {
|
||||
int volume = Integer.parseInt(guildManager.getSetting(GuildManager.Settings.MUSIC_VOLUME));
|
||||
|
||||
@@ -156,7 +156,7 @@ public class ConfigureCommand extends AbstractCommand {
|
||||
}
|
||||
|
||||
// Music topic change
|
||||
if (context.getArg(0).equals("music-topic")) {
|
||||
if (context.getArgument(0).equals("music-topic")) {
|
||||
if (args.length == 1) {
|
||||
boolean enabled = "1".equals(guildManager.getSetting(GuildManager.Settings.MUSIC_TOPIC));
|
||||
|
||||
@@ -178,7 +178,7 @@ public class ConfigureCommand extends AbstractCommand {
|
||||
}
|
||||
|
||||
// Debug
|
||||
if (context.getArg(0).equals("debug")) {
|
||||
if (context.getArgument(0).equals("debug")) {
|
||||
if (args.length == 1) {
|
||||
boolean debug = guildManager.isDebugEnabled();
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ public class BitcoinPriceCommand extends AbstractCommand {
|
||||
|
||||
@Override
|
||||
public void execute(CommandContext context) {
|
||||
String[] args = context.getArgumentsAsArray();
|
||||
String[] args = context.getArgs();
|
||||
String currency = "USD";
|
||||
|
||||
if (args.length == 1) {
|
||||
|
||||
@@ -63,7 +63,7 @@ public class CryptoPriceCommand extends AbstractCommand {
|
||||
|
||||
@Override
|
||||
public void execute(CommandContext context) {
|
||||
String[] args = context.getArgumentsAsArray();
|
||||
String[] args = context.getArgs();
|
||||
String currency = "USD";
|
||||
|
||||
if (args.length > 0) {
|
||||
|
||||
@@ -63,7 +63,7 @@ public class EthereumPriceCommand extends AbstractCommand {
|
||||
|
||||
@Override
|
||||
public void execute(CommandContext context) {
|
||||
String[] args = context.getArgumentsAsArray();
|
||||
String[] args = context.getArgs();
|
||||
String currency = "USD";
|
||||
|
||||
if (args.length == 1) {
|
||||
|
||||
@@ -63,7 +63,7 @@ public class LitecoinPriceCommand extends AbstractCommand {
|
||||
|
||||
@Override
|
||||
public void execute(CommandContext context) {
|
||||
String[] args = context.getArgumentsAsArray();
|
||||
String[] args = context.getArgs();
|
||||
String currency = "USD";
|
||||
|
||||
if (args.length == 1) {
|
||||
|
||||
@@ -56,7 +56,7 @@ public class BlacklistCommand extends AbstractCommand {
|
||||
|
||||
@Override
|
||||
public void execute(CommandContext context) {
|
||||
String[] args = context.getArgumentsAsArray();
|
||||
String[] args = context.getArgs();
|
||||
DBBlacklist controller = DBController.get(DBBlacklist.class);
|
||||
|
||||
if (args.length > 0 && args.length < 3) {
|
||||
|
||||
@@ -53,8 +53,8 @@ public class PruneCommand extends AbstractCommand {
|
||||
|
||||
@Override
|
||||
public void execute(CommandContext context) {
|
||||
if (context.getArgumentsAsArray().length == 1)
|
||||
ChannelFunction.bulkDeleteMessage(context.getChannel(), Integer.parseInt(context.getArgumentsAsArray()[0]));
|
||||
if (context.getArgs().length == 1)
|
||||
ChannelFunction.bulkDeleteMessage(context.getChannel(), Integer.parseInt(context.getArgument(0)));
|
||||
else
|
||||
context.getChannel().sendMessage("Failed to delete messages!").queue();
|
||||
}
|
||||
|
||||
@@ -56,15 +56,15 @@ public class DeleteQueueCommand extends AbstractMusicCommand {
|
||||
if (!MusicUtils.checkIfConnected(player, context))
|
||||
return;
|
||||
|
||||
if (context.getArgumentsAsArray().length == 0) {
|
||||
if (context.getArgs().length == 0) {
|
||||
context.reply("Select the track you want to delete from the queue (track# or all)");
|
||||
context.reply(MessageFunction.buildViewQueueMessage(player, context.getGuildUser(), true));
|
||||
}
|
||||
|
||||
if (context.getArgumentsAsArray().length > 0) {
|
||||
if (context.getArgs().length > 0) {
|
||||
|
||||
int queueSize = player.getQueueSize();
|
||||
if (context.getArg(0).equals("all")) {
|
||||
if (context.getArgument(0).equals("all")) {
|
||||
|
||||
if (queueSize > 0) {
|
||||
player.getScheduler().getQueueManager().clearQueue();
|
||||
@@ -75,7 +75,7 @@ public class DeleteQueueCommand extends AbstractMusicCommand {
|
||||
} else {
|
||||
|
||||
try {
|
||||
int num = Integer.parseInt(context.getArg(0));
|
||||
int num = Integer.parseInt(context.getArgument(0));
|
||||
|
||||
if (num > 0) {
|
||||
if (player.removeFromQueue(num)) {
|
||||
|
||||
@@ -50,7 +50,7 @@ public class SkipCommand extends AbstractMusicCommand {
|
||||
if (UserFunction.isAdmin(context.getGuildUser())) {
|
||||
if (context.getArgs().length > 0) {
|
||||
try {
|
||||
int skips = Integer.parseInt(context.getArg(0));
|
||||
int skips = Integer.parseInt(context.getArgument(0));
|
||||
player.skip(skips);
|
||||
|
||||
context.reply("Skipping %s track%s", skips, (skips > 1 ? "s" : ""));
|
||||
|
||||
@@ -46,7 +46,7 @@ public class VolumeCommand extends AbstractMusicCommand {
|
||||
|
||||
if (MusicUtils.checkIfConnected(player, context) && MusicUtils.isDj(player, context)) {
|
||||
try {
|
||||
int volume = Integer.parseInt(context.getArg(0));
|
||||
int volume = Integer.parseInt(context.getArgument(0));
|
||||
|
||||
if (volume > 0 && volume <= 100) {
|
||||
player.setVolume(volume);
|
||||
|
||||
@@ -61,7 +61,7 @@ public class DatabaseCommand extends AbstractCommand {
|
||||
@Override
|
||||
public void execute(CommandContext context) {
|
||||
//TODO: Clean up the mess
|
||||
String[] args = context.getArgumentsAsArray();
|
||||
String[] args = context.getArgs();
|
||||
context.getMessage().delete().queue();
|
||||
|
||||
if (!context.getGuildUser().getId().equals(Settings.getInstance().getCreatorId()))
|
||||
|
||||
@@ -64,15 +64,11 @@ public class CommandContext {
|
||||
return new CommandContext(message, member, user, guild, channel, jda);
|
||||
}
|
||||
|
||||
public String getArg(int index) {
|
||||
return getArgumentsAsArray()[index];
|
||||
public String getArgument(int index) {
|
||||
return getArgs()[index];
|
||||
}
|
||||
|
||||
public String[] getArgs() {
|
||||
return getArgumentsAsArray();
|
||||
}
|
||||
|
||||
public String[] getArgumentsAsArray() {
|
||||
String msg = message.getContentDisplay().trim();
|
||||
msg = msg.substring(Settings.getInstance().get("BOT_PREFIX", "$").length()).trim();
|
||||
String cmd = msg.split(" ", 2)[0];
|
||||
|
||||
@@ -41,7 +41,7 @@ public class JpaUtils {
|
||||
|
||||
if (object instanceof OGuild oGuild) {
|
||||
String cachedId = oGuild.getGuildId();
|
||||
Sentry.captureMessage("Trying to load Guild[" + cachedId + "] while deleted from database, reloading entity..", SentryLevel.ERROR);
|
||||
Sentry.captureMessage("Trying to load Guild[" + cachedId + "] while entity doesn't exist in database, reloading..", SentryLevel.ERROR);
|
||||
|
||||
GuildManager guildManager = GuildManager.getManager(cachedId);
|
||||
guildManager.reloadEntity();
|
||||
|
||||
Reference in new issue
Block a user