Triggers and responses
guideEvery AutoMod trigger kind with its options, and every response a rule can take.
This page lists what an AutoMod rule can look for and what it can do about it. Both are plain values: build them, tune them, then give them to a rule builder or to an existing rule. You're assumed to have a bot named "my-bot" logged in.
How triggers work
A trigger is created by one of five expressions, one per kind. Its options are write-only properties, and each one only applies to the kinds listed next to it: setting filtered keywords on a mention spam trigger is a readable error, not a silent no-op.
on message received seen by "my-bot": if discord content of event-message is "!words": set {_t} to a new automod keyword trigger with the keywords "badword" add "*worse*" to filtered keywords of {_t} set allow list of {_t} to "badwordle" set {_b} to a new automod rule builder named "Words" in event-guild for messages using {_t} add a new automod response blocking the message to automod responses of {_b} await set {_rule} to the build result of {_b}
[a] new automod keyword trigger [with [the] keywords %strings%]Matches messages containing one of the keywords. Keywords accept the wildcards '*' at the start, the end or both ("*bad*").Trigger kinds
Kind | Created with | One per guild |
|---|---|---|
Keyword | no | |
Pattern |
| no |
Preset |
| yes |
Mention spam | yes | |
Spam | yes |
Keywords accept a * wildcard at the start, the end or both ("*bad*" matches inside a word). Patterns are regular expressions in Rust syntax, 10 patterns of 260 characters at most. A keyword and a pattern trigger are the same Discord kind: a keyword trigger can also hold patterns, and the reverse; it needs at least one of either when the rule is built.
The presets are Discord's maintained word lists: profanity, sexual content and slurs.
Trigger options
Property | Applies to | Accepted values |
|---|---|---|
keyword, pattern | texts, | |
keyword, pattern | regex texts, | |
keyword, pattern, preset | texts that never trigger the rule | |
preset |
| |
mention spam | 1 to 50 unique mentions | |
mention spam |
|
set {_presets} to a new automod preset trigger with the presets profanity and slurs add sexual content to presets of {_presets} set allow list of {_presets} to "scunthorpe" set {_mentions} to a new automod mention spam trigger with a limit of 5 set mention raid protection of {_mentions} to true
[a] new automod preset trigger with [the] [presets] %keywordpresets%Matches messages against Discord's maintained keyword lists. Only one rule of this kind per guild.expression
new mention spam triggerAutoMod Trigger Config[a] new automod mention spam trigger with [a] [mention] limit [of] %number%Matches messages mentioning more unique users and roles than the limit (50 max). Only one rule of this kind per guild.Responses
A response is created by one of four expressions and never changes afterwards. A rule holds at most one response of each type: adding a second one of the same type replaces the first.
Response | Created with | Allowed on |
|---|---|---|
Block the message |
| message rules |
Send an alert |
| message rules |
Time the member out | keyword and mention spam rules | |
Block member interactions | member profile rules (added for you) |
The custom message of a blocked message is shown to its author, 150 characters at most. A timeout lasts up to 28 days.
set {_block} to a new automod response blocking the message with the custom message "Keep it clean" set {_alert} to a new automod response sending an alert to the channel event-channel set {_mute} to a new automod response timing the member out for 5 minutes set automod responses of {_b} to {_block}, {_alert} and {_mute}
A response reads back through response type, response message, response channel and response timeout; each is none when it does not apply to the response's type. response type compares against block message, send alert message, timeout and block member interaction.
[a] new automod response blocking [the] message [with [the] [custom] message %-string%]Blocks the offending message. The optional custom message (150 characters max) is shown to the member whose message was blocked.Errors you may see
Message (console) | Cause | Fix |
|---|---|---|
this property only applies to a mention spam trigger, not a keyword one (and the other kinds) | An option was set on a trigger kind that does not have it | Check the Applies to column above |
the timeout duration must be greater than 0 | A timeout response was created with a zero duration | Give it a real duration |
[50035] Invalid Form Body naming the trigger | A keyword trigger with no keyword and no pattern, a regex Discord rejects, a limit above 50 | Fix the field named in the message |