oopsy
This commit is contained in:
1 parent
496d6cc362
commit
8638b75258
1 file changed
+4
-1
@@ -56,13 +56,14 @@ public class ConfigureCommand extends AbstractCommand {
|
|||||||
public void execute(CommandContext context) {
|
public void execute(CommandContext context) {
|
||||||
String[] args = context.getArgumentsAsArray();
|
String[] args = context.getArgumentsAsArray();
|
||||||
MysqlDatabase database = DBController.get();
|
MysqlDatabase database = DBController.get();
|
||||||
|
GuildManager guildManager = GuildManager.getManager(context.getGuild());
|
||||||
|
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
|
|
||||||
if (context.getArg(0).equals("musicrole")) {
|
if (context.getArg(0).equals("musicrole")) {
|
||||||
|
|
||||||
if (args.length == 1) {
|
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;
|
Role role = null;
|
||||||
if (!roleDb.isEmpty()) {
|
if (!roleDb.isEmpty()) {
|
||||||
role = context.getGuild().getRoleById(roleDb);
|
role = context.getGuild().getRoleById(roleDb);
|
||||||
@@ -78,12 +79,14 @@ public class ConfigureCommand extends AbstractCommand {
|
|||||||
Role role = roles.get(0);
|
Role role = roles.get(0);
|
||||||
if (role.getGuild().getId().equals(context.getGuild().getId())) {
|
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();
|
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());
|
context.reply("Successfully set %s as the role needed for music command", role.getAsMention());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context.getArg(1).equals("reset")) {
|
if (context.getArg(1).equals("reset")) {
|
||||||
database.prepareAndExecuteAsync("UPDATE guild_settings SET music_role = null WHERE guild_id = ?", context.getGuild().getId()).blocking();
|
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");
|
context.reply("Successful reset of the role");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user