This commit is contained in:
anthorob committed 2022-02-18 17:33:29 -05:00
1 parent 496d6cc362
commit 8638b75258
1 file changed
+4 -1
@@ -56,13 +56,14 @@ public class ConfigureCommand extends AbstractCommand {
public void execute(CommandContext context) {
String[] args = context.getArgumentsAsArray();
MysqlDatabase database = DBController.get();
GuildManager guildManager = GuildManager.getManager(context.getGuild());
if (args.length > 0) {
if (context.getArg(0).equals("musicrole")) {
if (args.length == 1) {
String roleDb = GuildManager.getManager(context.getGuild()).getSetting(GuildManager.GuildSetting.MUSIC_ROLE);
String roleDb = guildManager.getSetting(GuildManager.GuildSetting.MUSIC_ROLE);
Role role = null;
if (!roleDb.isEmpty()) {
role = context.getGuild().getRoleById(roleDb);
@@ -78,12 +79,14 @@ public class ConfigureCommand extends AbstractCommand {
Role role = roles.get(0);
if (role.getGuild().getId().equals(context.getGuild().getId())) {
database.prepareAndExecuteAsync("UPDATE guild_settings SET music_role = ? WHERE guild_id = ?", role.getId(), context.getGuild().getId()).blocking();
guildManager.reloadSettings();
context.reply("Successfully set %s as the role needed for music command", role.getAsMention());
}
}
if (context.getArg(1).equals("reset")) {
database.prepareAndExecuteAsync("UPDATE guild_settings SET music_role = null WHERE guild_id = ?", context.getGuild().getId()).blocking();
guildManager.reloadSettings();
context.reply("Successful reset of the role");
}
}