AutoModerationRule

AutoModerationRule

Represents an Auto Moderation Rule

Constructor

new AutoModerationRule()

Properties:
Properties
Name Type Attributes Description
actions Array.<Object>

The actions that will be executed if the rule is triggered

actions[].metadata Object <nullable>

Additional data used when an action is executed

Name Type Attributes Description
channelID String <nullable>

The channel where user content will be logged (action type 2 only)

customMessage String <nullable>

Optional custom message up to 150 characters that will be shown to users when their message gets blocked (action type 1 only)

durationSeconds Number <nullable>

Timeout duration in seconds, up to 4 weeks (action type 3 only)

creator User

The user that created the Auto Moderation rule. If the user is uncached, this will be an object with an id key. No other properties are guaranteed

enabled Boolean

Whether the rule is enabled or not

eventType Number

Whether this rule applies for message sends (1) or member updates (2)

exemptChannels Array.<String>

A list of channel IDs that aren't affected by this rule

exemptRoles Array.<String>

A list of role IDs that aren't affected by this rule

guild Guild

The guild which this rule applies to. If the guild is uncached, this will be an object with an id key. No other properties are guaranteed

id String

The Auto Moderation Rule ID

name String

The name of this rule

triggerMetadata Object

Additional data used to determine whether a rule is triggered or not

Properties
Name Type Attributes Description
allowList Array.<String> <nullable>

Substrings which shouldn't trigger this rule (trigger types 1, 4 and 6 only). Max of 100 for types 1 and 6, max of 1000 for type 4

keywordFilter Array.<String> <nullable>

Substrings which should trigger this rule (trigger types 1 and 6 only). Max of 1000

mentionRaidProtectionEnabled Boolean <nullable>

Whether to automatically detect mention raids

mentionTotalLimit Number <nullable>

The number of unique roles/user mentions allowed per message. Max of 50

presets Array.<Number> <nullable>

The predefined wordsets which should trigger this rule. 1 for profanity, 2 for sexual content, 3 for slurs

regexPatterns Array.<String> <nullable>

Rust flavored Regex patterns which should trigger this rule. Max of 10

triggerType Number

The type of content which triggers this rule

Source:

Methods

delete(reasonopt) → {Promise}

Delete the auto moderation rule

Source:
Parameters:
Name Type Attributes Description
reason String <optional>

The reason to be displayed in audit logs

Returns:
Type:
Promise

edit(options) → {Promise.<AutoModerationRule>}

Edit an existing auto moderation rule

Source:
Parameters:
Name Type Description
options Object

The properties to edit

Name Type Attributes Default Description
actions Array.<Object> <optional>

The actions done when the rule is violated

enabled Boolean <optional>
false

If the rule is enabled, false by default

eventType Number <optional>

The event type for the rule

exemptChannels Array.<String> <optional>

Any channels where this rule does not apply

exemptRoles Array.<String> <optional>

Any roles to which this rule does not apply

name String <optional>

The name of the rule

triggerMetadata Object <optional>

The trigger metadata for the rule

triggerType Number <optional>

The trigger type of the rule

reason String <optional>

The reason to be displayed in audit logs

Returns:
Type:
Promise.<AutoModerationRule>