Skip to content

fix: honor mentions config in plain-text + webhook paths#6

Open
BoredManCodes wants to merge 2 commits into
ANutley:v2from
BoredManCodes:fix/allowed-mentions-config-swap
Open

fix: honor mentions config in plain-text + webhook paths#6
BoredManCodes wants to merge 2 commits into
ANutley:v2from
BoredManCodes:fix/allowed-mentions-config-swap

Conversation

@BoredManCodes

@BoredManCodes BoredManCodes commented May 21, 2026

Copy link
Copy Markdown
Contributor

DisLinkWebhookMessageBuilder.build() never called setAllowedMentions on its WebhookMessageBuilder, and the discord-webhooks library defaults that field to AllowedMentions.all(). WebhookClient.send(WebhookMessage) reads the message's own field to build the JSON body, the client-level setAllowedMentions we set in WebhookSender.createWebhookClientBuilder is never consulted on this path. Result: every webhook send told Discord "parse everything," so @everyone always pinged regardless of config.

Fix: forward the sender's allowed mentions onto the message builder so the JSON payload reflects the config.

Test plan

  • Built standalone, ran against a real guild with three channels in one webhook group (mentions.everyone=false).
  • Posted @everyone in the sending channel; targets received the text with no ping.
  • Toggle mentions.everyone=true and confirm it pings when explicitly enabled.
  • Sanity-check plain-text delivery with the swap fix.

AllowedMentionsBuilder is a record with positional fields (users,
roles, everyone), but MessageSender.getAllowedMentions() was passing
(everyone, role, user). In the plain-text bot path this miswired the
toggles directly: setting mentions.everyone=false actually blocked
USER mentions while the mentions.user value drove the @everyone flag.
The webhook path coincidentally worked because WebhookSender swapped
the slots back on read. Pass arguments in the record's declared order
and drop the compensating swap in WebhookSender.
WebhookMessageBuilder defaults its allowedMentions field to
AllowedMentions.all(), and WebhookClient.send(WebhookMessage) reads the
message's own field directly - the client-level setAllowedMentions on
WebhookClientBuilder is never consulted on this path. So every webhook
send told Discord to parse everything (including @everyone) regardless
of the mentions.* config.

Forward the sender's allowed mentions onto the message builder so the
JSON payload actually reflects what's configured.
@BoredManCodes BoredManCodes changed the title fix: honor mentions.everyone/user config in plain-text path fix: honor mentions config in plain-text + webhook paths May 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant