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