Uh oh!
There was an error while loading. Please reload this page.
Feat/cross channel spam automod - #553
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Deployment Notes: |
Summary
Adds a second spam automod —
checkCrossChannelSpaminAutoMod— that catches a pattern the existing same-channel spam check misses: a single user rapidly spreading messages across several different channels.What it does
ModerationConfig, so they're tunable per guild.How it works
CachedMessagenow stores achannelId, taken from the live message when it's cached — so the cache knows which channel each message came from. That's what lets the check count distinct channels without any extra Discord API calls; only the timeout and the deletions talk to Discord.checkCrossChannelSpamreads the author's recent messages from theMessageCachewithin the window, gathers the distinct channels, and passes the messages tohandleSpamonce the count crosses the threshold.handleSpamgains aList<CachedMessage>overload that times the user out and deletes each message by id.ModerationConfigfields:crossChannelSpamWindowSecondsandcrossChannelSpamMinChannels.Notes
channelIdisn't persisted to the database yet — it defaults to-1when read from the DB, per your suggestion. If it holds up, I can follow with a migration to store it properly.