automod

list

Get a list of all rules currently configured for the guild

await discord.automod.list('GUILD_ID')

get

Get a single rule

await discord.automod.get('GUILD_ID', 'RULE_ID')

create

Create a new rule

fieldtypedescription

name

string

the rule name

event_type

the event type

trigger_type

the trigger type

trigger_metadata?

the trigger metadata

actions

the actions which will execute when the rule is triggered

enabled?

boolean

whether the rule is enabled (false by default)

exempt_roles?

role_id[]

the role ids that should not be affected by the rule (Maximum of 20)

exempt_channels?

channel_id[]

the channel ids that should not be affected by the rule (Maximum of 50)

await discord.automod.create('GUILD_ID', rule /* above */)

modify

Modify an existing rule

await discord.automod.modify('GUILD_ID', 'RULE_ID', rule /* same as create but without trigger_type */)

delete

Delete a rule

await discord.automod.delete('GUILD_ID', 'RULE_ID')

classes

Rule

Fields

fieldtypedescription

id

Snowflake

guild_id

Snowflake

name

string

creator_id

Snowflake

event_type

1

trigger_type

1 | 3 | 4 | 5

trigger_metadata

object

actions

enabled

boolean

exempt_roles

Snowflake[]

exempt_channels

Snowflake

types

EventType

event typevalue description

MESSAGE_SEND

1

when a member sends or edits a message in the guild

Action

fieldtypedescription

type

the type of action

metadata?

additional metadata needed during execution for this specific action type

ActionType

action typevaluedescription

BLOCK_MESSAGE

1

blocks a member's message and prevents it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked.

SEND_ALERT_MESSAGE

2

logs user content to a specified channel

TIMEOUT

3

timeout user for a specified duration

ActionMetadata

fieldtypedescription

channel_id

Snowflake ID

channel to which user content should be logged

duration_seconds

integer

timeout duration in seconds

custom_message?

string

additional explanation that will be shown to members whenever their message is blocked

TriggerMetadata

fieldtypedescription

keyword_filter?

string[]

substrings which will be searched for in content (Maximum of 1000)

regex_patterns?

string[]

regular expression patterns which will be matched against content (Maximum of 10)

presets?

( 1 | 2 | 3 )[]

the internally pre-defined wordsets which will be searched for in content

allow_list?

string[]

substrings which should not trigger the rule (Maximum of 100 or 1000)

mention_total_limit?

integer

total number of unique role and user mentions allowed per message (Maximum of 50)

TriggerType

trigger typevalue description

KEYWORD

1

check if content contains words from a user defined list of keywords

SPAM

3

check if content represents generic spam

KEYWORD_PRESET

4

check if content contains words from internal pre-defined wordsets

MENTION_SPAM

5

check if content contains more unique mentions than allowed

Last updated