#13430: fix(discord): properly handle bot-sent @everyone mentions
channel: discord
stale
Cluster:
Slack Thread Management Improvements
Fixes the issue where bot-sent @everyone mentions were not being properly routed. This ensures that mentions from the bot are handled correctly in the Discord channel.
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR adjusts Discord preflight mention detection by changing how `hasAnyMention` is computed when `message.mentionedEveryone` is true, intending to handle bot-sent `@everyone` mentions differently during routing/mention-gating.
The change is localized to `src/discord/monitor/message-handler.preflight.ts`, where `hasAnyMention` is passed into `matchesMentionWithExplicit(...)` and later into `resolveMentionGatingWithBypass(...)` to decide whether messages should be treated as “mentioned” (and therefore eligible for handling) in guild channels that require mentions.
<h3>Confidence Score: 2/5</h3>
- Not safe to merge as-is; change breaks `@everyone` mention detection in common cases.
- The only functional change modifies `hasAnyMention` so that `mentionedEveryone` no longer counts unless `mentionedUsers.length > 0`, which will make real `@everyone` pings appear as having no mentions and can cause incorrect mention-gating behavior (dropping messages when mentions are required).
- src/discord/monitor/message-handler.preflight.ts
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
**Context used:**
- Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8))
- Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13))
<!-- /greptile_comment -->
Most Similar PRs
#13652: fix(discord): ensure default bot loads when multiple accounts are con…
by metav · 2026-02-10
79.9%
#7719: fix(slack): thread replies with @mentions dropped in requireMention...
by SocialNerd42069 · 2026-02-03
79.1%
#22940: fix(discord): detect voice messages for preflight transcription bef...
by aldoeliacim · 2026-02-21
78.0%
#23689: feat(discord): add ignoreOtherMentions config option
by Q00 · 2026-02-22
78.0%
#20697: feat(discord): auto-resolve user mentions in message content
by tdjackey · 2026-02-19
76.6%
#15900: fix(discord): filter bot's own messages early to prevent self-DoS
by Shuai-DaiDai · 2026-02-14
76.5%
#11774: fix: add guards for undefined mentionRegexes arrays
by ikvyk · 2026-02-08
76.2%
#13829: fix(googlechat): detect bot @mentions via user.type when botUser no...
by mcaxtr · 2026-02-11
76.1%
#7459: fix(signal): resolve mention placeholders to actual names
by gerigk-agent · 2026-02-02
75.4%
#10587: fix(extensions/mattermost): pass requireMention override from chatm...
by baku4 · 2026-02-06
75.2%