Attachment Spam
Flag messages that attach too many files at once. A simple per-message count check to stop drive-by file dumps.
Open AutoMod →Attachment Spam fires when a single message contains more attached files than the threshold you set. It is the thinnest trigger in AutoMod — one configuration field, one count check.
What is this?
A rule that fires when a single message attaches more files than your threshold (default 5). One configuration field, one count check, no pattern matching.
Why you might want it
For the ten-image dumps in one message that crash slower clients, and the upload-bait users who attach six screenshots when one would do. It's also a soft defence against payload spam from compromised accounts. The default of five is comfortably above any normal share.
message.attachments).max_attachments.Why use this rule?
- Stops low-effort image floods and "gallery dump" raids in chat channels.
- Prevents abuse where a single user pastes 10+ files to derail a conversation.
- Cheap insurance against payload-based bots that drop several files in one shot.
- Pairs cleanly with exempt channels so dedicated showcase / meme spaces stay untouched.
What it detects
A single message with more attached files than your configured maximum. The evaluator runs len(message.attachments) > max_attachments — nothing more.
What it does NOT detect
- Attachments accumulated across multiple messages — it is strictly per-message.
- Attachment type, size, or content — images, videos, and executables are counted the same.
- Embeds. A message with five YouTube or Twitter previews contains zero attachments.
- Stickers. Those live on
message.stickers, notmessage.attachments.
Configuration
| Field | Type | Default | What it means |
|---|---|---|---|
| max_attachments | integer | 5 | The rule fires when a message has more than this many attached files. |
Recommended starter settings
For a general-purpose chat server:
{
"max_attachments": 5
}max_attachments above 10 means this rule rarely fires for non-Nitro users.Common false positives
- Meme dumps or screenshot galleries in
#generalwhen the admin forgot to exempt a dedicated channel. - Bug-report threads where a reporter attaches multiple screenshots in one message.
- Legitimate asset bundles — fonts, art commissions, mod packs.
- Art channels where artists post a WIP set in a single message.
How to test this rule safely
Set the rule to Log Only
Log Only records matches without taking action. It is the right starting point for every AutoMod rule.
Lower the threshold for testing
Temporarily set max_attachments to 2 so you can trigger the rule with a handful of small images.
Post a message with 3 attachments
In a test channel you control, send a message with three tiny image attachments. Check the Event Log dashboard — you should see an entry with matched_pattern = "3 attachments".
Confirm a 2-attachment message does NOT fire
Post a message with exactly 2 attachments. No Event Log entry should appear — the comparison is strictly greater than.
Flip to Live
Restore your real threshold and switch the rule from Log Only to Live.
Known current behavior
- Current behavior: embeds and stickers do not count as attachments. A message with five Twitter previews or a pile of stickers will not trigger this rule.
- Current behavior: allowlist words do not apply. Attachment Spam is a volumetric trigger, so the rule's
allowlist_wordsare ignored for attachment counting — a captioned flood can no longer sneak past the rule just because it contains an allowlisted word. - Current behavior: the threshold uses a strict greater-than comparison. Setting
max_attachments = 5means six attachments fires; five does not. - Current behavior: an attachment-only message still triggers the rule. Empty message content does not exempt a file dump from the count check.
Action reference
Pair this trigger with any of the five AutoMod actions. Trigger-specific note: Discord deletes attachments alongside their parent message, so the delete action cleans up the files too — no separate attachment-scrubbing step is needed.
action_config field.