Docs/Plugins/Spam
Spam
Rate-based anti-spam with per-level rules and automatic punishment.
The spam plugin counts behaviour over time windows and punishes members who
exceed your limits. It is bucket-based: each rule tracks its own window, and
a member trips the rule by exceeding count within interval seconds.
plugins:
spam:
levels:
0: # rules for everyone at level 0+
max_messages:
count: 12
interval: 10
max_mentions:
count: 8
interval: 10
punishment: TEMPMUTE
punishment_duration: 600
clean: true
clean_count: 50
clean_duration: 120
50: {} # mods exempt
Setup checklist
- Open Setup > Filters and add one rule for level 0. Begin with a generous count and a short interval.
- Set
punishment: NONEfor the first test. Turn on cleanup only in a private channel where deleting the test messages is safe. - Add an empty block at your staff level, such as
50: {}, if moderators should be exempt. - Subscribe a mod log channel to Spam violation so every trip is visible even without punishment.
- Save, run Diagnostics, and use the message simulator to see which counters one test message increments.
- As a level 0 test member, cross the threshold. Confirm the violation log and optional cleanup.
- Add the intended punishment and duration. Test again before expanding the rule to busy channels.
count is the allowed bucket size and interval is seconds. A rule trips when
the member exceeds the count inside that window. Keep those units in mind when
copying examples.
Tuning individual rules
Every rule block takes more than count and interval. Give one its own
punishment, punishment_duration, or channel_whitelist and that rule
overrides the sub-config default - so you can mute for mention floods while
merely cleaning up on link spam.
Two values worth knowing:
punishment: NONEdetects and cleans without punishing anyone, which is the safe way to trial a new limit.count: 0(orinterval: 0) switches a rule off without deleting it.
Scoping
Like censor, rules live in sub-configs keyed by level (levels) or
role (roles); an empty higher-level block exempts staff. Each sub-config
can also carry a channel_whitelist of places it ignores (a listed
channel's threads and forum posts are ignored with it).
The rules
Each of these takes { count, interval }:
max_messages- raw message rate.max_mentions- user/role mentions. Only mentions that actually ping count: a reply with reply-pinging turned off adds nothing, while a reply that pings the original author counts as one mention.max_duplicates- repeated identical messages.max_links,max_attachments,max_emojis,max_newlines,max_upper_case- exactly what they say.
Punishment and cleanup
punishment- what happens on a trip (for exampleTEMPMUTE,MUTE,KICK,TEMPBAN,BAN), withpunishment_durationfor the timed ones. Punishments create real infractions, so they show in the mod log and expire automatically.- Every trip also logs the Spam violation mod log event (which rule tripped and why), whether or not a punishment is configured - enable it in your mod log channel's event picker to see spam hits as they happen.
clean- delete the offending backlog: up toclean_countrecent messages from the member withinclean_durationseconds.
Testing
The Setup → Filters message simulator includes spam: it lists every rule
that would count a given message and the per-message cost, so you can sanity-
check thresholds before a raid does it for you. Each rule shows the config
key it comes from (for example plugins.spam.levels.50.max_mentions), so
tuning it is a straight lookup in your config.
Troubleshooting
- A moderator cannot trigger the test: a higher-level empty block exempts them.
- Detection logs but nobody is punished:
NONEis detection-only, and a per-rule punishment overrides the surrounding level or role default. - A timed mute or ban fails: set the corresponding duration and check the infractions plugin, mute role, Discord permission, and role hierarchy.
- Cleanup misses old messages: it only considers up to
clean_countmessages insideclean_durationseconds. - A channel appears exempt: inspect both the sub-config and per-rule
channel_whitelistvalues.