diff --git a/src/main/java/de/presti/ree6/commands/impl/fun/ShibaImage.java b/src/main/java/de/presti/ree6/commands/impl/fun/ShibaImage.java index 63df14724..d85c6cd56 100644 --- a/src/main/java/de/presti/ree6/commands/impl/fun/ShibaImage.java +++ b/src/main/java/de/presti/ree6/commands/impl/fun/ShibaImage.java @@ -1,6 +1,7 @@ package de.presti.ree6.commands.impl.fun; import com.google.gson.JsonArray; +import com.google.gson.JsonElement; import de.presti.ree6.bot.BotWorker; import de.presti.ree6.commands.Category; import de.presti.ree6.commands.CommandEvent; @@ -23,7 +24,14 @@ public class ShibaImage implements ICommand { */ @Override public void onPerform(CommandEvent commandEvent) { - JsonArray js = RequestUtility.requestJson(RequestUtility.Request.builder().url("https://shibe.online/api/shibes?count=1&urls=true&httpsUrls=true").build()).getAsJsonArray(); + JsonElement jsonElement = RequestUtility.requestJson(RequestUtility.Request.builder().url("https://shibe.online/api/shibes?count=1&urls=true&httpsUrls=true").build()); + + if (jsonElement.isJsonObject()) { + commandEvent.reply(commandEvent.getResource("message.default.retrievalError"), 5); + return; + } + + JsonArray js = jsonElement.getAsJsonArray(); EmbedBuilder em = new EmbedBuilder(); diff --git a/src/main/java/de/presti/ree6/commands/impl/mod/Setup.java b/src/main/java/de/presti/ree6/commands/impl/mod/Setup.java index 9cb4dbd89..98fda4648 100644 --- a/src/main/java/de/presti/ree6/commands/impl/mod/Setup.java +++ b/src/main/java/de/presti/ree6/commands/impl/mod/Setup.java @@ -135,6 +135,11 @@ public void onPerform(CommandEvent commandEvent) { switch (commandEvent.getSubcommandGroup()) { case "auditlog" -> { + if (!commandEvent.getGuild().getSelfMember().hasPermission(Permission.MANAGE_WEBHOOKS)) { + commandEvent.reply(commandEvent.getResource("message.default.insufficientPermission", Permission.MANAGE_WEBHOOKS.name())); + return; + } + if (commandEvent.getSubcommand().equals("set")) { if (guildChannelUnion.getType() == ChannelType.TEXT) { guildChannelUnion.asTextChannel().createWebhook(BotConfig.getBotName() + "-Logs").queue(webhook -> { @@ -158,6 +163,11 @@ public void onPerform(CommandEvent commandEvent) { } } case "welcome" -> { + if (!commandEvent.getGuild().getSelfMember().hasPermission(Permission.MANAGE_WEBHOOKS)) { + commandEvent.reply(commandEvent.getResource("message.default.insufficientPermission", Permission.MANAGE_WEBHOOKS.name())); + return; + } + if (commandEvent.getSubcommand().equals("set")) { if (guildChannelUnion.getType() == ChannelType.TEXT) { guildChannelUnion.asTextChannel().createWebhook(BotConfig.getBotName() + "-Welcome").queue(webhook -> {