Repository navigation
fix(bot): stop taking every message for the one of a webhook - #357
Merged
Merged
Conversation
|
Architecture Data flow Tip Set 🪧 More tips
Thanks for using PR Lens! It's free for OSS. If it helped, a star helps other teams find it. |
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — the full single-commit diff of this PR.
isWebhookMessageguard — new helper inguards.tsusingtypeof message.webhookId === 'string', which treats bothundefinedandnullas "not a webhook".- Listener call sites —
messageCreate,messageCreateAutoDelete,messageCreateHoneypotandrawMessageUpdateNotifyreplacewebhookId !== nullwith the helper. A grep ofprojects/finds no remainingwebhookId !== nullchecks. - Tests —
guards.test.tsbuilds a real gatewayMessagefor the member and webhook cases. ThewebhookId: nulllines are removed from the autoDelete and honeypot mocks, so those tests now exercise theundefinedcase that hid this bug.
claude-sonnet-5-5 | 𝕏
6 of 11 tasks
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

❓ Type of change
📚 Description
I wrote in the honeypot channel of the staging server with an alt and nothing happened: the message stayed, no case, no log. The dispatch had reached the bot (the message was in the Redis cache), the settings pointed at the right channel and the alt had no moderator role.
The listeners skip webhooks with
message.webhookId !== null, but aMessageof plugin-gateway inherits that getter from@discordjs/structures, which leaves itundefinedwhen there is no webhook (discord.js givesnull). So every message read as a webhook's, since the port to the gateway on 5 October:messageCreatenever emittedUserMessage(the whole message auto-moderation), the honeypot caught nobody, edited messages were never logged and auto-delete took every author for a bot. The four checks now go throughisWebhookMessage.The mocks of the listener tests had
webhookId: null, which is why nothing failed. The plugin should returnnulllike discord.js does; that is wolfstar-project/plugins#276, and this guard stays correct either way.

Confidence Score: 5/5
The reviewed changes are safe to merge; no blocking issues were found.Reviews (1) · Last reviewed commit: "fix(bot): stop taking every message for ..." · Reviewed by Greptile