diff --git a/src/main/java/com/bbn/hadder/commands/owner/GuildLeaveCommand.java b/src/main/java/com/bbn/hadder/commands/owner/GuildLeaveCommand.java index 8b2a21e..13cb60d 100644 --- a/src/main/java/com/bbn/hadder/commands/owner/GuildLeaveCommand.java +++ b/src/main/java/com/bbn/hadder/commands/owner/GuildLeaveCommand.java @@ -16,13 +16,17 @@ public class GuildLeaveCommand implements Command { if (event.getConfig().getOwners().toString().contains(event.getAuthor().getId())) { if (args.length > 0) { Guild guild = event.getJDA().getGuildById(args[0]); - guild.leave().queue(); - event.getTextChannel() - .sendMessage(event.getMessageEditor() - .getMessage(MessageEditor.MessageType.INFO, "commands.owner.guildleave.success.title", - "", "commands.owner.guildleave.success.description", guild.getName()) - .build()) - .queue(); + try { + guild.leave().queue(); + event.getTextChannel() + .sendMessage(event.getMessageEditor() + .getMessage(MessageEditor.MessageType.INFO, "commands.owner.guildleave.success.title", + "", "commands.owner.guildleave.success.description", guild.getName()) + .build()) + .queue(); + } catch (Exception e) { + event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.WARNING, "commands.owner.guildleave.error.title", "", "commands.owner.guildleave.help.description", guild.getName()).build()).queue(); + } } else { event.getHelpCommand().sendHelp(this, event); } diff --git a/src/main/resources/Translations/Translations_en.properties b/src/main/resources/Translations/Translations_en.properties index 36eb9bf..dfb232c 100644 --- a/src/main/resources/Translations/Translations_en.properties +++ b/src/main/resources/Translations/Translations_en.properties @@ -202,6 +202,8 @@ commands.owner.eval.help.description = Execute the given code commands.owner.eval.help.usage = commands.owner.guildleave.success.title = Successfully left commands.owner.guildleave.success.description = I successfully left %extra%. +commands.owner.guildleave.error.title = Can not leave +commands.owner.guildleave.error.description = I can not leave from this guild. Maybe this isn't a ID? commands.owner.guildleave.help.description = Quit from a guild commands.owner.reboot.help.description = Restart the bot commands.owner.shutdown.success.title = Shutdown