Skip to content

Commit cd75db6

Browse files
authored
Fixed Exception when ScamBlocker checks messages outside of TextChannel (#1217)
1 parent 96c3e89 commit cd75db6

File tree

1 file changed

+5
-1
lines changed
  • application/src/main/java/org/togetherjava/tjbot/features/moderation/scam

1 file changed

+5
-1
lines changed

Diff for: application/src/main/java/org/togetherjava/tjbot/features/moderation/scam/ScamBlocker.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,11 @@ public void onMessageReceived(MessageReceivedEvent event) {
130130
return;
131131
}
132132

133-
boolean isSafe = !isBotTrapChannel.test(event.getChannel().asTextChannel());
133+
boolean isSafe = true;
134+
if (event.getChannel() instanceof TextChannel textChannel
135+
&& isBotTrapChannel.test(textChannel)) {
136+
isSafe = false;
137+
}
134138

135139
Message message = event.getMessage();
136140
String content = message.getContentDisplay();

0 commit comments

Comments
 (0)