Auto Moderation Rule Object
Auto Moderation Rule Structure
Example Auto Moderation Rule
Trigger Types
Characterizes the type of content which can trigger the rule.Trigger Metadata
Additional data used to determine whether a rule should be triggered. Different fields are relevant based on the value of trigger_type.
* A keyword can be a phrase which contains multiple words. Wildcard symbols can be used to customize how each keyword will be matched. Each keyword must be 60 characters or less.
** Only Rust flavored regex is currently supported, which can be tested in online editors such as Rustexp. Each regex pattern must be 260 characters or less.
*** Each
allow_list keyword can be a phrase which contains multiple words. Wildcard symbols can be used to customize how each keyword will be matched. Rules with KEYWORD trigger_type accept a maximum of 100 keywords. Rules with KEYWORD_PRESET trigger_type accept a maximum of 1000 keywords.
Trigger Metadata Field Limits
Keyword Preset Types
Event Types
Indicates in what event context a rule should be checked.Keyword Matching Strategies
Use the wildcard symbol (*) at the beginning or end of a keyword to define how it should be matched. All keywords are case insensitive.
Prefix - word must start with the keyword
Suffix - word must end with the keyword
Anywhere - keyword can appear anywhere in the content
Whole Word - keyword is a full word or phrase and must be surrounded by whitespace
Auto Moderation Action Object
An action which will execute whenever a rule is triggered.Auto Moderation Action Structure
* Can be omitted based on
type. See the Associated Action Types column in action metadata to understand which type values require metadata to be set.
Action Types
* A
TIMEOUT action can only be set up for KEYWORD and MENTION_SPAM rules. The MODERATE_MEMBERS permission is required to use the TIMEOUT action type.
Action Metadata
Additional data used when an action is executed. Different fields are relevant based on the value of action type.Auto Moderation Permission Requirements
Users are required to have theMANAGE_GUILD permission to access all Auto Moderation resources.
Some action types require additional permissions, e.g. the TIMEOUT action type requires an additional MODERATE_MEMBERS permission.
List Auto Moderation Rules for Guild
Get a list of all rules currently configured for the guild. Returns a list of auto moderation rule objects for the given guild.This endpoint requires the
MANAGE_GUILD permission.Get Auto Moderation Rule
Get a single rule. Returns an auto moderation rule object.This endpoint requires the
MANAGE_GUILD permission.Create Auto Moderation Rule
Create a new rule. Returns an auto moderation rule on success. Fires an Auto Moderation Rule Create Gateway event.This endpoint requires the
MANAGE_GUILD permission.This endpoint supports the
X-Audit-Log-Reason header.JSON Params
* Can be omitted based on
trigger_type. See the Associated Trigger Types column in trigger metadata to understand which trigger_type values require trigger_metadata to be set.
See Trigger Types for limits on how many rules of each trigger type can be created per guild.
Modify Auto Moderation Rule
Modify an existing rule. Returns an auto moderation rule on success. Fires an Auto Moderation Rule Update Gateway event.Requires
MANAGE_GUILD permissions.All parameters for this endpoint are optional.
This endpoint supports the
X-Audit-Log-Reason header.JSON Params
* Can be omitted based on
trigger_type. See the Associated Trigger Types column in trigger metadata to understand which trigger_type values require trigger_metadata to be set.
Delete Auto Moderation Rule
Delete a rule. Returns a204 on success. Fires an Auto Moderation Rule Delete Gateway event.
This endpoint requires the
MANAGE_GUILD permission.This endpoint supports the
X-Audit-Log-Reason header.