44import net .dv8tion .jda .api .Permission ;
55import net .dv8tion .jda .api .entities .Member ;
66import net .dv8tion .jda .api .entities .Message ;
7- import net .dv8tion .jda .api .entities .channel .concrete . TextChannel ;
7+ import net .dv8tion .jda .api .entities .channel .unions . MessageChannelUnion ;
88import net .dv8tion .jda .api .events .message .MessageReceivedEvent ;
99import net .dv8tion .jda .api .events .message .MessageUpdateEvent ;
1010import net .dv8tion .jda .api .hooks .ListenerAdapter ;
@@ -150,7 +150,7 @@ private void checkContentAutomod(@Nonnull Message message) {
150150 "Automod: Advertising" ,
151151 message .getGuild ().getMember (message .getJDA ().getSelfUser ()),
152152 message .getChannel (),
153- isSuggestionsChannel (message .getChannel (). asTextChannel () )
153+ isSuggestionsChannel (message .getChannel ())
154154 );
155155 message .delete ().queue (success -> {
156156 }, error -> log .info ("Message was deleted before Automod was able to handle it." ));
@@ -168,7 +168,7 @@ private void checkContentAutomod(@Nonnull Message message) {
168168 "Automod: Suspicious Link" ,
169169 message .getGuild ().getMember (message .getJDA ().getSelfUser ()),
170170 message .getChannel (),
171- isSuggestionsChannel (message .getChannel (). asTextChannel () )
171+ isSuggestionsChannel (message .getChannel ())
172172 );
173173 message .delete ().queue (success -> {
174174 }, error -> log .info ("Message was deleted before Automod was able to handle it." ));
@@ -256,7 +256,8 @@ public boolean hasAdvertisingLink(@NotNull Message message) {
256256 return false ;
257257 }
258258
259- private boolean isSuggestionsChannel (@ NotNull TextChannel channel ) {
260- return channel .equals (botConfig .get (channel .getGuild ()).getModerationConfig ().getSuggestionChannel ());
259+ private boolean isSuggestionsChannel (@ NotNull MessageChannelUnion channel ) {
260+ return channel .getType ().isGuild () &&
261+ channel .getIdLong () == botConfig .get (channel .asGuildMessageChannel ().getGuild ()).getModerationConfig ().getSuggestionChannel ().getIdLong ();
261262 }
262263}
0 commit comments