CVE-2022-39302: Incorrect Authorization (CWE-863)
value: Ree6 is a moderation bot. This vulnerability would allow other server owners to create configurations such as "Better-Audit-Logging" which contain a channel from another server as a target. This would mean you could send log messages to another Guild channel and bypass raid and webhook protections. A specifically crafted log message could allow spamming and mass advertisements. This issue has been patched in version 1.9.9. There are currently no known workarounds.
CWE description: The product performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions.
CVSS v3 base score: 5.4
Published: 2022-10-14T00:15Z
Repository: https://github.com/Ree6-Applications/Ree6
Language: Java
Files changed: src/main/java/de/presti/ree6/commands/impl/community/InstagramNotifier.java, src/main/java/de/presti/ree6/commands/impl/community/RedditNotifier.java, src/main/java/de/presti/ree6/commands/impl/community/TwitchNotifier.java, src/main/java/de/presti/ree6/commands/impl/community/TwitterNotifier.java, src/main/java/de/presti/ree6/commands/impl/community/YouTubeNotifier.java, src/main/java/de/presti/ree6/commands/impl/mod/EmbedSender.java, src/main/java/de/presti/ree6/commands/impl/mod/Import.java, src/main/java/de/presti/ree6/commands/impl/mod/Setup.java, src/main/java/de/presti/ree6/events/OtherEvents.java, src/main/java/de/presti/ree6/sql/SQLWorker.java
Commit date: 2022-09-30 12:54:07 +0200
Commit message: Removed News-Channel.
Fixed Cross-Server Channel Exploit.
Fixed Temporal-Voice setup.

Diff: diff --git a/src/main/java/de/presti/ree6/commands/impl/community/InstagramNotifier.java b/src/main/java/de/presti/ree6/commands/impl/community/InstagramNotifier.java
index 0a56d4c..aafedac 100644
--- a/src/main/java/de/presti/ree6/commands/impl/community/InstagramNotifier.java
+++ b/src/main/java/de/presti/ree6/commands/impl/community/InstagramNotifier.java
@@ -44,11 +44,12 @@ public class InstagramNotifier implements ICommand {
             } else {
                 Main.getInstance().getCommandManager().sendMessage("Please use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "instagramnotifier list/add/remove", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
             }
         } else if(commandEvent.getArguments().length == 3) {
 
-            if (commandEvent.getMessage().getMentions().getChannels(TextChannel.class).isEmpty()) {
+            if (commandEvent.getMessage().getMentions().getChannels(TextChannel.class).isEmpty() ||
+                    !commandEvent.getMessage().getMentions().getChannels(TextChannel.class).get(0).getGuild().getId().equals(commandEvent.getGuild().getId())) {
                 Main.getInstance().getCommandManager().sendMessage("Please use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "instagramnotifier add/remove InstagramName #Channel", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
                 return;
             }
 
             String name = commandEvent.getArguments()[1];
diff --git a/src/main/java/de/presti/ree6/commands/impl/community/RedditNotifier.java b/src/main/java/de/presti/ree6/commands/impl/community/RedditNotifier.java
index 3dbc2b6..cadf605 100644
--- a/src/main/java/de/presti/ree6/commands/impl/community/RedditNotifier.java
+++ b/src/main/java/de/presti/ree6/commands/impl/community/RedditNotifier.java
@@ -44,11 +44,12 @@ public class RedditNotifier implements ICommand {
             } else {
                 Main.getInstance().getCommandManager().sendMessage("Please use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "redditnotifier list/add/remove", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
             }
         } else if(commandEvent.getArguments().length == 3) {
 
-            if (commandEvent.getMessage().getMentions().getChannels(TextChannel.class).isEmpty()) {
+            if (commandEvent.getMessage().getMentions().getChannels(TextChannel.class).isEmpty() ||
+                    !commandEvent.getMessage().getMentions().getChannels(TextChannel.class).get(0).getGuild().getId().equals(commandEvent.getGuild().getId())) {
                 Main.getInstance().getCommandManager().sendMessage("Please use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "redditnotifier add/remove Subreddit #Channel", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
                 return;
             }
 
             String name = commandEvent.getArguments()[1];
diff --git a/src/main/java/de/presti/ree6/commands/impl/community/TwitchNotifier.java b/src/main/java/de/presti/ree6/commands/impl/community/TwitchNotifier.java
index bf1bdae..1f1cd0b 100644
--- a/src/main/java/de/presti/ree6/commands/impl/community/TwitchNotifier.java
+++ b/src/main/java/de/presti/ree6/commands/impl/community/TwitchNotifier.java
@@ -44,11 +44,12 @@ public class TwitchNotifier implements ICommand {
             } else {
                 Main.getInstance().getCommandManager().sendMessage("Please use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "twitch list/add/remove", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
             }
         } else if (commandEvent.getArguments().length == 3) {
 
-            if (commandEvent.getMessage().getMentions().getChannels(TextChannel.class).isEmpty()) {
+            if (commandEvent.getMessage().getMentions().getChannels(TextChannel.class).isEmpty() ||
+                    !commandEvent.getMessage().getMentions().getChannels(TextChannel.class).get(0).getGuild().getId().equals(commandEvent.getGuild().getId())) {
                 Main.getInstance().getCommandManager().sendMessage("Please use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "twitch add/remove TwitchName #Channel", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
                 return;
             }
 
             String name = commandEvent.getArguments()[1];
diff --git a/src/main/java/de/presti/ree6/commands/impl/community/TwitterNotifier.java b/src/main/java/de/presti/ree6/commands/impl/community/TwitterNotifier.java
index df37eca..703bac6 100644
--- a/src/main/java/de/presti/ree6/commands/impl/community/TwitterNotifier.java
+++ b/src/main/java/de/presti/ree6/commands/impl/community/TwitterNotifier.java
@@ -44,11 +44,12 @@ public class TwitterNotifier implements ICommand {
             } else {
                 Main.getInstance().getCommandManager().sendMessage("Please use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "twitternotifier list/add/remove", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
             }
         } else if(commandEvent.getArguments().length == 3) {
 
-            if (commandEvent.getMessage().getMentions().getChannels(TextChannel.class).isEmpty()) {
+            if (commandEvent.getMessage().getMentions().getChannels(TextChannel.class).isEmpty() ||
+                    !commandEvent.getMessage().getMentions().getChannels(TextChannel.class).get(0).getGuild().getId().equals(commandEvent.getGuild().getId())) {
                 Main.getInstance().getCommandManager().sendMessage("Please use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "twitternotifier add/remove TwitterName #Channel", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
                 return;
             }
 
             String name = commandEvent.getArguments()[1];
diff --git a/src/main/java/de/presti/ree6/commands/impl/community/YouTubeNotifier.java b/src/main/java/de/presti/ree6/commands/impl/community/YouTubeNotifier.java
index d09c8a9..3e460b2 100644
--- a/src/main/java/de/presti/ree6/commands/impl/community/YouTubeNotifier.java
+++ b/src/main/java/de/presti/ree6/commands/impl/community/YouTubeNotifier.java
@@ -44,11 +44,12 @@ public class YouTubeNotifier implements ICommand {
             } else {
                 Main.getInstance().getCommandManager().sendMessage("Please use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "youtubenotifier list/add/remove", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
             }
         } else if(commandEvent.getArguments().length == 3) {
 
-            if (commandEvent.getMessage().getMentions().getChannels(TextChannel.class).isEmpty()) {
+            if (commandEvent.getMessage().getMentions().getChannels(TextChannel.class).isEmpty() ||
+                    !commandEvent.getMessage().getMentions().getChannels(TextChannel.class).get(0).getGuild().getId().equals(commandEvent.getGuild().getId())) {
                 Main.getInstance().getCommandManager().sendMessage("Please use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "youtubenotifier add/remove YouTubeChannel #Channel", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
                 return;
             }
 
             String name = commandEvent.getArguments()[1];
diff --git a/src/main/java/de/presti/ree6/commands/impl/mod/EmbedSender.java b/src/main/java/de/presti/ree6/commands/impl/mod/EmbedSender.java
index 2ab9cde..2ad67ec 100644
--- a/src/main/java/de/presti/ree6/commands/impl/mod/EmbedSender.java
+++ b/src/main/java/de/presti/ree6/commands/impl/mod/EmbedSender.java
@@ -4,10 +4,11 @@ import de.presti.ree6.commands.Category;
 import de.presti.ree6.commands.CommandEvent;
 import de.presti.ree6.commands.interfaces.Command;
 import de.presti.ree6.commands.interfaces.ICommand;
 import de.presti.ree6.main.Main;
 import net.dv8tion.jda.api.EmbedBuilder;
+import net.dv8tion.jda.api.Permission;
 import net.dv8tion.jda.api.interactions.commands.OptionMapping;
 import net.dv8tion.jda.api.interactions.commands.OptionType;
 import net.dv8tion.jda.api.interactions.commands.build.CommandData;
 import net.dv8tion.jda.internal.interactions.CommandDataImpl;
 
@@ -28,10 +29,15 @@ public class EmbedSender implements ICommand {
         if (!commandEvent.isSlashCommand()) {
             commandEvent.reply("This command is only available as slash command!");
             return;
         }
 
+        if (!commandEvent.getMember().hasPermission(Permission.MESSAGE_MANAGE)) {
+            commandEvent.reply("You do not have the permission to do that!");
+            return;
+        }
+
         OptionMapping title = commandEvent.getSlashCommandInteractionEvent().getOption("title");
         OptionMapping description = commandEvent.getSlashCommandInteractionEvent().getOption("description");
         OptionMapping color = commandEvent.getSlashCommandInteractionEvent().getOption("color");
         OptionMapping footer = commandEvent.getSlashCommandInteractionEvent().getOption("footer");
         OptionMapping footerIcon = commandEvent.getSlashCommandInteractionEvent().getOption("footer_icon");
diff --git a/src/main/java/de/presti/ree6/commands/impl/mod/Import.java b/src/main/java/de/presti/ree6/commands/impl/mod/Import.java
index b2c1e08..a7b2e1e 100644
--- a/src/main/java/de/presti/ree6/commands/impl/mod/Import.java
+++ b/src/main/java/de/presti/ree6/commands/impl/mod/Import.java
@@ -6,10 +6,11 @@ import de.presti.ree6.commands.CommandEvent;
 import de.presti.ree6.commands.interfaces.Command;
 import de.presti.ree6.commands.interfaces.ICommand;
 import de.presti.ree6.main.Main;
 import de.presti.ree6.sql.entities.level.ChatUserLevel;
 import de.presti.ree6.utils.external.RequestUtility;
+import net.dv8tion.jda.api.Permission;
 import net.dv8tion.jda.api.interactions.commands.OptionMapping;
 import net.dv8tion.jda.api.interactions.commands.OptionType;
 import net.dv8tion.jda.api.interactions.commands.build.CommandData;
 import net.dv8tion.jda.internal.interactions.CommandDataImpl;
 
@@ -22,10 +23,15 @@ public class Import implements ICommand {
     /**
      * @inheritDoc
      */
     @Override
     public void onPerform(CommandEvent commandEvent) {
+        if (!commandEvent.getMember().hasPermission(Permission.MANAGE_SERVER)) {
+            commandEvent.reply("You do not have the permission to do that!");
+            return;
+        }
+
         if (commandEvent.isSlashCommand()) {
             OptionMapping optionMapping = commandEvent.getSlashCommandInteractionEvent().getOption("bot");
             commandEvent.getArguments()[0] = optionMapping.getAsString();
         }
 
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 6fa8a3b..a369d35 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
@@ -38,11 +38,10 @@ public class Setup implements ICommand {
                     .setDescription("Which configuration do you want to check out?");
 
             List<SelectOption> optionList = new ArrayList<>();
             optionList.add(SelectOption.of("Audit-Logging", "log"));
             optionList.add(SelectOption.of("Welcome-channel", "welcome"));
-            optionList.add(SelectOption.of("News-channel", "news"));
             optionList.add(SelectOption.of("Autorole", "autorole"));
             optionList.add(SelectOption.of("Temporal-Voice", "tempvoice"));
             optionList.add(SelectOption.of("Statistics", "statistics"));
 
             SelectMenu selectMenu = new SelectMenuImpl("setupActionMenu", "Select a configuration Step!", 1, 1, false, optionList);
diff --git a/src/main/java/de/presti/ree6/events/OtherEvents.java b/src/main/java/de/presti/ree6/events/OtherEvents.java
index 5f376d5..ba72857 100644
--- a/src/main/java/de/presti/ree6/events/OtherEvents.java
+++ b/src/main/java/de/presti/ree6/events/OtherEvents.java
@@ -862,33 +862,20 @@ public class OtherEvents extends ListenerAdapter {
                         embedBuilder.setDescription("You can set up our own Welcome-Messages!\nYou can choice the Welcome-Channel by your own and even configure the Message!");
 
                         event.editMessageEmbeds(embedBuilder.build()).setActionRow(new SelectMenuImpl("setupWelcomeMenu", "Select your Action", 1, 1, false, optionList)).queue();
                     }
 
-                    case "news" -> {
-                        optionList.add(SelectOption.of("Setup", "newsSetup"));
-
-                        if (Main.getInstance().getSqlConnector().getSqlWorker().isNewsSetup(event.getGuild().getId()))
-                            optionList.add(SelectOption.of("Delete", "newsDelete"));
-
-                        optionList.add(SelectOption.of("Back to Menu", "backToSetupMenu"));
-
-                        embedBuilder.setDescription("You can set up our own Ree6-News!\nBy setting up Ree6-News on a specific channel you will get a Message in the given Channel, when ever Ree6 gets an update!");
-
-                        event.editMessageEmbeds(embedBuilder.build()).setActionRow(new SelectMenuImpl("setupNewsMenu", "Select your Action", 1, 1, false, optionList)).queue();
-                    }
-
                     case "autorole" -> {
                         embedBuilder.setDescription("You can set up our own Autorole-System!\nYou can select Roles that Users should get upon joining the Server!");
 
                         event.editMessageEmbeds(embedBuilder.build()).setActionRow(Button.link("https://cp.ree6.de", "Webinterface")).queue();
                     }
 
                     case "tempvoice" -> {
                         optionList.add(SelectOption.of("Setup", "tempVoiceSetup"));
 
-                        if (Main.getInstance().getSqlConnector().getSqlWorker().isNewsSetup(event.getGuild().getId()))
+                        if (Main.getInstance().getSqlConnector().getSqlWorker().getEntity(TemporalVoicechannel.class, "SELECT * FROM TemporalVoicechannel WHERE GID=?", event.getGuild().getId()).isSuccess())
                             optionList.add(SelectOption.of("Delete", "tempVoiceDelete"));
 
                         optionList.add(SelectOption.of("Back to Menu", "backToSetupMenu"));
 
                         embedBuilder.setDescription("You can set up your own Temporal Voicechannel!\nBy setting up Temporal Voicechannel on a specific channel which will be used to create a new Voicechannel when ever someones joins into it!");
@@ -1218,66 +1205,10 @@ public class OtherEvents extends ListenerAdapter {
                     event.editMessageEmbeds(embedBuilder.build()).queue();
                 }
 
             }
 
-            case "setupNewsMenu" -> {
-
-                if (checkPerms(event.getMember(), event.getChannel())) {
-                    return;
-                }
-
-                EmbedBuilder embedBuilder = new EmbedBuilder(event.getMessage().getEmbeds().get(0));
-
-                List<SelectOption> optionList = new ArrayList<>();
-
-                switch (event.getInteraction().getValues().get(0)) {
-
-                    case "backToSetupMenu" -> sendDefaultChoice(event);
-
-                    case "newsSetup" -> {
-                        for (TextChannel channel : event.getGuild().getTextChannels()) {
-                            optionList.add(SelectOption.of(channel.getName(), channel.getId()));
-                        }
-
-                        embedBuilder.setDescription("Which Channel do you want to use as News-Channel?");
-
-                        event.editMessageEmbeds(embedBuilder.build()).setActionRow(new SelectMenuImpl("setupNewsChannel", "Select a Channel!", 1, 1, false, optionList)).queue();
-                    }
-
-                    default -> {
-                        if (event.getMessage().getEmbeds().isEmpty() || event.getMessage().getEmbeds().get(0) == null)
-                            return;
-
-                        embedBuilder.setDescription("You somehow selected a Invalid Option? Are you a Wizard?");
-                        event.editMessageEmbeds(embedBuilder.build()).queue();
-                    }
-                }
-            }
-
-            case "setupNewsChannel" -> {
-                if (checkPerms(event.getMember(), event.getChannel())) {
-                    return;
-                }
-
-                EmbedBuilder embedBuilder = new EmbedBuilder(event.getMessage().getEmbeds().get(0));
-
-                TextChannel textChannel = event.getGuild().getTextChannelById(event.getInteraction().getValues().get(0));
-
-                if (textChannel != null) {
-                    textChannel.createWebhook("Ree6-News").queue(webhook -> {
-                        Main.getInstance().getSqlConnector().getSqlWorker().setNewsWebhook(event.getGuild().getId(), webhook.getId(), webhook.getToken());
-                        embedBuilder.setDescription("Successfully changed the News-Channel, nice work!");
-                        embedBuilder.setColor(Color.GREEN);
-                        event.editMessageEmbeds(embedBuilder.build()).setComponents(new ArrayList<>()).queue();
-                    });
-                } else {
-                    embedBuilder.setDescription("The given Channel doesn't exists, how did you select it? Are you a Wizard?");
-                    event.editMessageEmbeds(embedBuilder.build()).queue();
-                }
-            }
-
             default -> {
                 if (event.getMessage().getEmbeds().isEmpty() || event.getMessage().getEmbeds().get(0) == null) return;
 
                 EmbedBuilder embedBuilder = new EmbedBuilder(event.getMessage().getEmbeds().get(0));
 
@@ -1296,11 +1227,10 @@ public class OtherEvents extends ListenerAdapter {
         EmbedBuilder embedBuilder = new EmbedBuilder(event.getMessage().getEmbeds().get(0));
 
         List<SelectOption> optionList = new ArrayList<>();
         optionList.add(SelectOption.of("Audit-Logging", "log"));
         optionList.add(SelectOption.of("Welcome-channel", "welcome"));
-        optionList.add(SelectOption.of("News-channel", "news"));
         optionList.add(SelectOption.of("Autorole", "autorole"));
         optionList.add(SelectOption.of("Temporal-Voice", "tempvoice"));
         optionList.add(SelectOption.of("Statistics", "statistics"));
 
         embedBuilder.setDescription("Which configuration do you want to check out?");
diff --git a/src/main/java/de/presti/ree6/sql/SQLWorker.java b/src/main/java/de/presti/ree6/sql/SQLWorker.java
index a37983b..ab2d4fc 100644
--- a/src/main/java/de/presti/ree6/sql/SQLWorker.java
+++ b/src/main/java/de/presti/ree6/sql/SQLWorker.java
@@ -350,63 +350,10 @@ public record SQLWorker(SQLConnector sqlConnector) {
         return getEntity(WebhookWelcome.class, "SELECT * FROM WelcomeWebhooks WHERE GID=?", guildId).isSuccess();
     }
 
     //endregion
 
-    //region News
-
-    /**
-     * Get the NewsWebhooks data.
-     *
-     * @param guildId the ID of the Guild.
-     * @return {@link WebhookNews} with all the needed data.
-     */
-    public WebhookNews getNewsWebhook(String guildId) {
-        SQLResponse sqlResponse = getEntity(WebhookNews.class, "SELECT * FROM NewsWebhooks WHERE GID=?", guildId);
-        return sqlResponse.isSuccess() ? (WebhookNews) sqlResponse.getEntity() : null;
-    }
-
-    /**
-     * Set the NewsWebhooks in our Database.
-     *
-     * @param guildId   the ID of the Guild.
-     * @param webhookId the ID of the Webhook.
-     * @param authToken the Auth-token to verify the access.
-     */
-    public void setNewsWebhook(String guildId, String webhookId, String authToken) {
-
-        // Check if there is already a Webhook set.
-        if (isNewsSetup(guildId)) {
-            // Get the Guild from the ID.
-            Guild guild = BotWorker.getShardManager().getGuildById(guildId);
-
-            if (guild != null) {
-                Webhook webhookEntity = getNewsWebhook(guildId);
-                // Delete the existing Webhook.
-                guild.retrieveWebhooks().queue(webhooks -> webhooks.stream().filter(webhook -> webhook.getToken() != null).filter(webhook -> webhook.getId().equalsIgnoreCase(webhookEntity.getChannelId()) && webhook.getToken().equalsIgnoreCase(webhookEntity.getToken())).forEach(webhook -> webhook.delete().queue()));
-            }
-
-            // Delete the entry.
-            sqlConnector.querySQL("DELETE FROM NewsWebhooks WHERE GID=?", guildId);
-        }
-
-        saveEntity(new WebhookNews(guildId, webhookId, authToken));
-
-    }
-
-    /**
-     * Check if the News Webhook has been set in our Database for this Server.
-     *
-     * @param guildId the ID of the Guild.
-     * @return {@link Boolean} if true, it has been set | if false, it hasn't been set.
-     */
-    public boolean isNewsSetup(String guildId) {
-        return getEntity(WebhookNews.class, "SELECT * FROM NewsWebhooks WHERE GID=?", guildId).isSuccess();
-    }
-
-    //endregion
-
     //region Twitch Notifier
 
     /**
      * Get the TwitchNotify data.
      *
diff --git a/src/main/java/de/presti/ree6/sql/entities/webhook/WebhookNews.java b/src/main/java/de/presti/ree6/sql/entities/webhook/WebhookNews.java
deleted file mode 100644
index 546ad13..0000000
--- a/src/main/java/de/presti/ree6/sql/entities/webhook/WebhookNews.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package de.presti.ree6.sql.entities.webhook;
-
-import de.presti.ree6.sql.base.annotations.Table;
-
-/**
- * SQL Entity for the News-Webhooks.
- */
-@Table(name = "NewsWebhooks")
-public class WebhookNews extends Webhook {
-
-    /**
-     * Constructor.
-     */
-    public WebhookNews() {
-    }
-
-    /**
-     * @inheritDoc
-     */
-    public WebhookNews(String guildId, String channelId, String token) {
-        super(guildId, channelId, token);
-    }
-}

Vulnerable code:             if (commandEvent.getMessage().getMentions().getChannels(TextChannel.class).isEmpty()) {
            if (commandEvent.getMessage().getMentions().getChannels(TextChannel.class).isEmpty()) {
            if (commandEvent.getMessage().getMentions().getChannels(TextChannel.class).isEmpty()) {
            if (commandEvent.getMessage().getMentions().getChannels(TextChannel.class).isEmpty()) {
            if (commandEvent.getMessage().getMentions().getChannels(TextChannel.class).isEmpty()) {
            optionList.add(SelectOption.of("News-channel", "news"));
                    case "news" -> {
                        optionList.add(SelectOption.of("Setup", "newsSetup"));

                        if (Main.getInstance().getSqlConnector().getSqlWorker().isNewsSetup(event.getGuild().getId()))
                            optionList.add(SelectOption.of("Delete", "newsDelete"));

                        optionList.add(SelectOption.of("Back to Menu", "backToSetupMenu"));

                        embedBuilder.setDescription("You can set up our own Ree6-News!\nBy setting up Ree6-News on a specific channel you will get a Message in the given Channel, when ever Ree6 gets an update!");

                        event.editMessageEmbeds(embedBuilder.build()).setActionRow(new SelectMenuImpl("setupNewsMenu", "Select your Action", 1, 1, false, optionList)).queue();
                    }

                        if (Main.getInstance().getSqlConnector().getSqlWorker().isNewsSetup(event.getGuild().getId()))
            case "setupNewsMenu" -> {

                if (checkPerms(event.getMember(), event.getChannel())) {
                    return;
                }

                EmbedBuilder embedBuilder = new EmbedBuilder(event.getMessage().getEmbeds().get(0));

                List<SelectOption> optionList = new ArrayList<>();

                switch (event.getInteraction().getValues().get(0)) {

                    case "backToSetupMenu" -> sendDefaultChoice(event);

                    case "newsSetup" -> {
                        for (TextChannel channel : event.getGuild().getTextChannels()) {
                            optionList.add(SelectOption.of(channel.getName(), channel.getId()));
                        }

                        embedBuilder.setDescription("Which Channel do you want to use as News-Channel?");

                        event.editMessageEmbeds(embedBuilder.build()).setActionRow(new SelectMenuImpl("setupNewsChannel", "Select a Channel!", 1, 1, false, optionList)).queue();
                    }

                    default -> {
                        if (event.getMessage().getEmbeds().isEmpty() || event.getMessage().getEmbeds().get(0) == null)
                            return;

                        embedBuilder.setDescription("You somehow selected a Invalid Option? Are you a Wizard?");
                        event.editMessageEmbeds(embedBuilder.build()).queue();
                    }
                }
            }

            case "setupNewsChannel" -> {
                if (checkPerms(event.getMember(), event.getChannel())) {
                    return;
                }

                EmbedBuilder embedBuilder = new EmbedBuilder(event.getMessage().getEmbeds().get(0));

                TextChannel textChannel = event.getGuild().getTextChannelById(event.getInteraction().getValues().get(0));

                if (textChannel != null) {
                    textChannel.createWebhook("Ree6-News").queue(webhook -> {
                        Main.getInstance().getSqlConnector().getSqlWorker().setNewsWebhook(event.getGuild().getId(), webhook.getId(), webhook.getToken());
                        embedBuilder.setDescription("Successfully changed the News-Channel, nice work!");
                        embedBuilder.setColor(Color.GREEN);
                        event.editMessageEmbeds(embedBuilder.build()).setComponents(new ArrayList<>()).queue();
                    });
                } else {
                    embedBuilder.setDescription("The given Channel doesn't exists, how did you select it? Are you a Wizard?");
                    event.editMessageEmbeds(embedBuilder.build()).queue();
                }
            }

        optionList.add(SelectOption.of("News-channel", "news"));
    //region News

    /**
     * Get the NewsWebhooks data.
     *
     * @param guildId the ID of the Guild.
     * @return {@link WebhookNews} with all the needed data.
     */
    public WebhookNews getNewsWebhook(String guildId) {
        SQLResponse sqlResponse = getEntity(WebhookNews.class, "SELECT * FROM NewsWebhooks WHERE GID=?", guildId);
        return sqlResponse.isSuccess() ? (WebhookNews) sqlResponse.getEntity() : null;
    }

    /**
     * Set the NewsWebhooks in our Database.
     *
     * @param guildId   the ID of the Guild.
     * @param webhookId the ID of the Webhook.
     * @param authToken the Auth-token to verify the access.
     */
    public void setNewsWebhook(String guildId, String webhookId, String authToken) {

        // Check if there is already a Webhook set.
        if (isNewsSetup(guildId)) {
            // Get the Guild from the ID.
            Guild guild = BotWorker.getShardManager().getGuildById(guildId);

            if (guild != null) {
                Webhook webhookEntity = getNewsWebhook(guildId);
                // Delete the existing Webhook.
                guild.retrieveWebhooks().queue(webhooks -> webhooks.stream().filter(webhook -> webhook.getToken() != null).filter(webhook -> webhook.getId().equalsIgnoreCase(webhookEntity.getChannelId()) && webhook.getToken().equalsIgnoreCase(webhookEntity.getToken())).forEach(webhook -> webhook.delete().queue()));
            }

            // Delete the entry.
            sqlConnector.querySQL("DELETE FROM NewsWebhooks WHERE GID=?", guildId);
        }

        saveEntity(new WebhookNews(guildId, webhookId, authToken));

    }

    /**
     * Check if the News Webhook has been set in our Database for this Server.
     *
     * @param guildId the ID of the Guild.
     * @return {@link Boolean} if true, it has been set | if false, it hasn't been set.
     */
    public boolean isNewsSetup(String guildId) {
        return getEntity(WebhookNews.class, "SELECT * FROM NewsWebhooks WHERE GID=?", guildId).isSuccess();
    }

    //endregion

package de.presti.ree6.sql.entities.webhook;

import de.presti.ree6.sql.base.annotations.Table;

/**
 * SQL Entity for the News-Webhooks.
 */
@Table(name = "NewsWebhooks")
public class WebhookNews extends Webhook {

    /**
     * Constructor.
     */
    public WebhookNews() {
    }

    /**
     * @inheritDoc
     */
    public WebhookNews(String guildId, String channelId, String token) {
        super(guildId, channelId, token);
    }
}
Fixed code:             if (commandEvent.getMessage().getMentions().getChannels(TextChannel.class).isEmpty() ||
                    !commandEvent.getMessage().getMentions().getChannels(TextChannel.class).get(0).getGuild().getId().equals(commandEvent.getGuild().getId())) {
            if (commandEvent.getMessage().getMentions().getChannels(TextChannel.class).isEmpty() ||
                    !commandEvent.getMessage().getMentions().getChannels(TextChannel.class).get(0).getGuild().getId().equals(commandEvent.getGuild().getId())) {
            if (commandEvent.getMessage().getMentions().getChannels(TextChannel.class).isEmpty() ||
                    !commandEvent.getMessage().getMentions().getChannels(TextChannel.class).get(0).getGuild().getId().equals(commandEvent.getGuild().getId())) {
            if (commandEvent.getMessage().getMentions().getChannels(TextChannel.class).isEmpty() ||
                    !commandEvent.getMessage().getMentions().getChannels(TextChannel.class).get(0).getGuild().getId().equals(commandEvent.getGuild().getId())) {
            if (commandEvent.getMessage().getMentions().getChannels(TextChannel.class).isEmpty() ||
                    !commandEvent.getMessage().getMentions().getChannels(TextChannel.class).get(0).getGuild().getId().equals(commandEvent.getGuild().getId())) {
import net.dv8tion.jda.api.Permission;
        if (!commandEvent.getMember().hasPermission(Permission.MESSAGE_MANAGE)) {
            commandEvent.reply("You do not have the permission to do that!");
            return;
        }

import net.dv8tion.jda.api.Permission;
        if (!commandEvent.getMember().hasPermission(Permission.MANAGE_SERVER)) {
            commandEvent.reply("You do not have the permission to do that!");
            return;
        }

                        if (Main.getInstance().getSqlConnector().getSqlWorker().getEntity(TemporalVoicechannel.class, "SELECT * FROM TemporalVoicechannel WHERE GID=?", event.getGuild().getId()).isSuccess())