DiSky DiSky v5.0.0-b1

Triggers and responses

guide

Every AutoMod trigger kind with its options, and every response a rule can take.

automodtriggersresponses

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}
expression new keyword triggerAutoMod Trigger Config[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*").AutoMod Trigger Configsince 5.0.0-a2

Trigger kinds

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, set or add

keyword, pattern

regex texts, set or add

keyword, pattern, preset

texts that never trigger the rule

preset

profanity, sexual content, slurs; set, add or remove

mention spam

1 to 50 unique mentions

mention spam

true, false

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
expression new preset triggerAutoMod Trigger Config[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.AutoMod Trigger Configsince 5.0.0-a2expression 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.AutoMod Trigger Configsince 5.0.0-a2

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 , , and ; 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.

expression new block messageAutoMod Response[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.AutoMod Responsesince 5.0.0-a2

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

AutoMod Trigger Config type 11 syntaxes What an automod rule looks for: custom keywords or regex patterns, a preset keyword list, mention spam or generic spam. Create one with the 'new automod ... trigger' expressions, tune it with its properties, then give it to an automod rule builder (or set 'trigger config of' an existing rule).
Was this page helpful?
An unhandled error has occurred. Reload 🗙

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.