Skip to content

Commit

Permalink
Don't debug-log ignoring own webhooks (#1628)
Browse files Browse the repository at this point in the history
  • Loading branch information
Scarsz committed Jan 16, 2024
2 parents b172fde + 88e0d6a commit 07bbd90
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ public void onGuildMessageReceived(GuildMessageReceivedEvent event) {

// block webhooks
if (event.isWebhookMessage()) {
if (DiscordSRV.config().getBoolean("DiscordChatChannelBlockWebhooks")) {
DiscordSRV.debug(Debug.DISCORD_TO_MINECRAFT, "Received Discord message from webhook" + event.getAuthor() + " but DiscordChatChannelBlockWebhooks is on");
return;
}

// Prevent our own webhook from being picked up
String webhook = WebhookUtil.getWebhookUrlFromCache(event.getChannel());
if (webhook != null && webhook.split("/")[6].equals(event.getAuthor().getId())) return;

if (DiscordSRV.config().getBoolean("DiscordChatChannelBlockWebhooks")) {
DiscordSRV.debug(Debug.DISCORD_TO_MINECRAFT, "Received Discord message from webhook " + event.getAuthor() + " but DiscordChatChannelBlockWebhooks is on");
return;
}
}

// canned responses
Expand Down

0 comments on commit 07bbd90

Please sign in to comment.