Skip to content

feat(discord): DISCORD_IGNORE_NO_MENTION — skip messages that @mention others but not the bot#3640

Merged
teknium1 merged 1 commit intomainfrom
hermes/hermes-ec5223e1
Mar 29, 2026
Merged

feat(discord): DISCORD_IGNORE_NO_MENTION — skip messages that @mention others but not the bot#3640
teknium1 merged 1 commit intomainfrom
hermes/hermes-ec5223e1

Conversation

@teknium1
Copy link
Copy Markdown
Contributor

Salvage of PR #3310 (luojiesi).

When DISCORD_IGNORE_NO_MENTION=true (default), if a Discord message mentions other users but not the bot, the bot stays silent. Prevents the bot from interrupting conversations between humans in shared channels.

Fix over original PR

Scoped to server channels only — DMs are excluded. In the original PR, a DM like "tell @alice about the project" would be silently dropped because message.mentions includes Alice but not the bot. In DMs the user is always talking to the bot, so mentions are just references.

How it works

The check runs in on_message after bot filtering, before _handle_message():

  1. Read DISCORD_IGNORE_NO_MENTION env var (default: true)
  2. If the message has mentions AND is NOT a DM AND the bot is NOT among the mentioned → skip
  3. Otherwise, proceed to _handle_message() as normal

Complements the existing DISCORD_REQUIRE_MENTION gating (which requires the bot to be @mentioned to respond). This new check handles the inverse case: someone explicitly @mentioning someone else.

Tests

1621 gateway tests pass, 0 failures.

Closes #3310

…n others but not the bot

When DISCORD_IGNORE_NO_MENTION=true (default), if a message mentions
other users but not the bot, the bot stays silent. Prevents the bot
from interrupting conversations between humans in shared channels.

Scoped to server channels only — DMs are excluded because the user
is always talking to the bot there (mentions are just references).
@teknium1 teknium1 merged commit 17617e4 into main Mar 29, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants