From a98d189b1b9cecd2a267fa481726cbf9e29f8ae0 Mon Sep 17 00:00:00 2001 From: MateoDeveloper Date: Sat, 30 Apr 2022 19:02:44 -0500 Subject: [PATCH 01/49] add message type and embed type for AutoMod alerts --- docs/resources/Channel.md | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/docs/resources/Channel.md b/docs/resources/Channel.md index 270b4bdffb..bcf273bf8b 100644 --- a/docs/resources/Channel.md +++ b/docs/resources/Channel.md @@ -308,6 +308,7 @@ Represents a message sent in a channel within Discord. | THREAD_STARTER_MESSAGE | 21 | | GUILD_INVITE_REMINDER | 22 | | CONTEXT_MENU_COMMAND | 23 | +| AUTO_MODERATION_MESSAGE | 24 | ###### Message Activity Structure @@ -555,14 +556,15 @@ A thread member is used to indicate whether a user has joined a thread or not. Embed types are "loosely defined" and, for the most part, are not used by our clients for rendering. Embed attributes power what is rendered. Embed types should be considered deprecated and might be removed in a future API version. -| Type | Description | -|---------|----------------------------------------------------| -| rich | generic embed rendered from embed attributes | -| image | image embed | -| video | video embed | -| gifv | animated gif image embed rendered as a video embed | -| article | article embed | -| link | link embed | +| Type | Description | +|----------------------------|----------------------------------------------------| +| rich | generic embed rendered from embed attributes | +| image | image embed | +| video | video embed | +| gifv | animated gif image embed rendered as a video embed | +| article | article embed | +| link | link embed | +| auto_moderation_message | embed for auto moderation alerts | ###### Embed Thumbnail Structure From d478d4eed4de072acb27c3dfe8579ad2dbf8fb0c Mon Sep 17 00:00:00 2001 From: MateoDeveloper Date: Sun, 1 May 2022 10:29:26 -0500 Subject: [PATCH 02/49] apply suggestions --- docs/resources/Channel.md | 4 ++-- docs/resources/Guild.md | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/resources/Channel.md b/docs/resources/Channel.md index bcf273bf8b..bbb1a5135e 100644 --- a/docs/resources/Channel.md +++ b/docs/resources/Channel.md @@ -308,7 +308,7 @@ Represents a message sent in a channel within Discord. | THREAD_STARTER_MESSAGE | 21 | | GUILD_INVITE_REMINDER | 22 | | CONTEXT_MENU_COMMAND | 23 | -| AUTO_MODERATION_MESSAGE | 24 | +| AUTO_MODERATION_ACTION | 24 | ###### Message Activity Structure @@ -564,7 +564,7 @@ Embed types are "loosely defined" and, for the most part, are not used by our cl | gifv | animated gif image embed rendered as a video embed | | article | article embed | | link | link embed | -| auto_moderation_message | embed for auto moderation alerts | +| auto_moderation_message | embed containing blocked content by automod | ###### Embed Thumbnail Structure diff --git a/docs/resources/Guild.md b/docs/resources/Guild.md index 0a32212383..be1cb01281 100644 --- a/docs/resources/Guild.md +++ b/docs/resources/Guild.md @@ -153,6 +153,7 @@ Guilds in Discord represent an isolated collection of users and channels, and ar | VERIFIED | guild is verified | | VIP_REGIONS | guild has access to set 384kbps bitrate in voice (previously VIP voice servers) | | WELCOME_SCREEN_ENABLED | guild has enabled the welcome screen | +| AUTO_MODERATION | guild has enabled the auto moderation system | ###### Example Guild From 36345c140da09977cfc69ae6acc4a2b97ef18a79 Mon Sep 17 00:00:00 2001 From: MateoDeveloper Date: Mon, 2 May 2022 10:44:19 -0500 Subject: [PATCH 03/49] change description of auto_moderation_message --- docs/resources/Channel.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/resources/Channel.md b/docs/resources/Channel.md index bbb1a5135e..117a23c2f6 100644 --- a/docs/resources/Channel.md +++ b/docs/resources/Channel.md @@ -564,7 +564,7 @@ Embed types are "loosely defined" and, for the most part, are not used by our cl | gifv | animated gif image embed rendered as a video embed | | article | article embed | | link | link embed | -| auto_moderation_message | embed containing blocked content by automod | +| auto_moderation_message | automod alert embed | ###### Embed Thumbnail Structure From f05999a55897ff9ff2bfceddaf23cfa9116d3691 Mon Sep 17 00:00:00 2001 From: MateoDeveloper Date: Mon, 2 May 2022 15:13:53 -0500 Subject: [PATCH 04/49] add audit log events: create, update and delete --- docs/resources/Audit_Log.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/resources/Audit_Log.md b/docs/resources/Audit_Log.md index d0ba05bc8c..597f3272b8 100644 --- a/docs/resources/Audit_Log.md +++ b/docs/resources/Audit_Log.md @@ -99,6 +99,9 @@ Whenever an admin action is performed on the API, an entry is added to the respe | THREAD_UPDATE | 111 | | THREAD_DELETE | 112 | | APPLICATION_COMMAND_PERMISSION_UPDATE | 121 | +| AUTO_MODERATION_RULE_CREATE | 140 | +| AUTO_MODERATION_RULE_UPDATE | 141 | +| AUTO_MODERATION_RULE_DELETE | 142 | ###### Optional Audit Entry Info From f3bd10684e078dcb8690b5a56abb7a3c65e729f8 Mon Sep 17 00:00:00 2001 From: MateoDeveloper <79017590+Mateo-tem@users.noreply.github.com> Date: Thu, 5 May 2022 23:46:02 -0500 Subject: [PATCH 05/49] add audit log events: block message --- docs/resources/Audit_Log.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/resources/Audit_Log.md b/docs/resources/Audit_Log.md index 597f3272b8..fdceaafc75 100644 --- a/docs/resources/Audit_Log.md +++ b/docs/resources/Audit_Log.md @@ -102,6 +102,7 @@ Whenever an admin action is performed on the API, an entry is added to the respe | AUTO_MODERATION_RULE_CREATE | 140 | | AUTO_MODERATION_RULE_UPDATE | 141 | | AUTO_MODERATION_RULE_DELETE | 142 | +| AUTO_MODERATION_BLOCK_MESSAGE | 143 | ###### Optional Audit Entry Info From ca5d4f3e4b43ad6f815d22f75123323f8449042e Mon Sep 17 00:00:00 2001 From: MateoDeveloper Date: Thu, 12 May 2022 23:18:20 -0500 Subject: [PATCH 06/49] add automod rule object --- docs/resources/Audit_Log.md | 6 ++-- docs/resources/Guild.md | 58 +++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 3 deletions(-) diff --git a/docs/resources/Audit_Log.md b/docs/resources/Audit_Log.md index dcec47c470..2226dc5406 100644 --- a/docs/resources/Audit_Log.md +++ b/docs/resources/Audit_Log.md @@ -120,9 +120,9 @@ If no object is noted, there won't be a `changes` array in the entry, though oth | THREAD_UPDATE | 111 | Thread was updated | [Thread](#DOCS_RESOURCES_CHANNEL/thread-metadata-object) | | THREAD_DELETE | 112 | Thread was deleted | [Thread](#DOCS_RESOURCES_CHANNEL/thread-metadata-object) | | APPLICATION_COMMAND_PERMISSION_UPDATE | 121 | Permissions were updated for a command | [Command Permission](#DOCS_INTERACTIONS_APPLICATION_COMMANDS/application-command-permissions-object-application-command-permissions-structure)\* | -| AUTO_MODERATION_RULE_CREATE | 140 | AutoMod rule was created | | -| AUTO_MODERATION_RULE_UPDATE | 141 | AutoMod rule was updated | | -| AUTO_MODERATION_RULE_DELETE | 142 | AutoMod rule was deleted | | +| AUTO_MODERATION_RULE_CREATE | 140 | AutoMod rule was created | [AutoMod Rule](#DOCS_RESOURCES_GUILD/automod-rule-object) | +| AUTO_MODERATION_RULE_UPDATE | 141 | AutoMod rule was updated | [AutoMod Rule](#DOCS_RESOURCES_GUILD/automod-rule-object) | +| AUTO_MODERATION_RULE_DELETE | 142 | AutoMod rule was deleted | [AutoMod Rule](#DOCS_RESOURCES_GUILD/automod-rule-object) | | AUTO_MODERATION_BLOCK_MESSAGE | 143 | Message was blocked by AutoMod (according to a rule) | | \* Object has exception(s) to available keys. See the [exceptions](#DOCS_RESOURCES_AUDIT_LOG/audit-log-change-object-audit-log-change-exceptions) section below for details. diff --git a/docs/resources/Guild.md b/docs/resources/Guild.md index 88b1dcfdcc..c1a550c7f6 100644 --- a/docs/resources/Guild.md +++ b/docs/resources/Guild.md @@ -498,6 +498,64 @@ Giving the member a role will bypass Membership Screening as well as the guild's > warn > We are making significant changes to the Membership Screening API specifically related to getting and editing the Membership Screening object. Long story short is that it can be improved. As such, we have removed those documentation. There will **not be** any changes to how pending members work, as outlined above. That behavior will stay the same. +### AutoMod Rule Object + +###### AutoMod Rule Structure + +| Field | Type | Description | +| ---------------- | ------------------- | ------------------------------------------------------------------------------------------------------ | +| name | string | the auto-mod rule name | +| trigger_type | integer | the auto-mod rule [trigger type](#DOCS_RESOURCES_GUILD/automod-rule-object-automod-rule-trigger-types) | +| event_type | integer | the auto-mod rule [event type](#DOCS_RESOURCES_GUILD/automod-rule-object-automod-rule-event-types) | +| actions | array | the auto-mod rule [actions](#DOCS_RESOURCES_GUILD/automod-rule-object-automod-rule-actions) | +| trigger_metadata | object | the auto-mod rule keywords, up to 1000 | +| enabled | boolean | whether the auto-mod rule is enabled | +| exempt_roles | array of snowflakes | the role ids that should not be affected by the rule | +| exempt_channels | array of snowflakes | the channel ids that should not be affected by the rule | +| position | integer | the auto-mod rule position between all the rules | + +###### AutoMod Rule Trigger Types + +| Type | Value | Description | +| ---------------- | ------- | ------------------------ | +| KEYWORD_FILTER | 1 | filter of specific words | + +###### AutoMod Event Types + +| Type | Value | Description | +| ---------------- | ------- | ---------------------------------------- | +| MESSAGE_SEND | 1 | when a member sends a message on a guild | + +###### AutoMod Rule Actions + +| Type | Value | Description | +| ---------------- | ------- | ----------------------------------------------------- | +| BLOCK_MESSAGE | 1 | blocks the content of a message according to the rule | +| SEND_AN_ALERT | 2 | sends an alert with the message to a specific channel | + +###### Example AutoMod Rule + +```json +{ + "name": "Keyword Filter 1", + "trigger_type": 1, + "event_type": 1, + "actions": [ + { + "type": 1, + "metadata": {} + } + ], + "trigger_metadata": { + "keyword_filter": ["cat*", "*cat", "*ana*"] + }, + "enabled": true, + "exempt_roles": [], + "exempt_channels": [], + "position": 0 +} +``` + ## Create Guild % POST /guilds Create a new guild. Returns a [guild](#DOCS_RESOURCES_GUILD/guild-object) object on success. Fires a [Guild Create](#DOCS_TOPICS_GATEWAY/guild-create) Gateway event. From 836ba22bffda80eb6b87fdb528af444ad0e576f6 Mon Sep 17 00:00:00 2001 From: MateoDeveloper Date: Fri, 13 May 2022 22:45:15 -0500 Subject: [PATCH 07/49] add missing word --- docs/resources/Guild.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/resources/Guild.md b/docs/resources/Guild.md index c1a550c7f6..73d9c2fa71 100644 --- a/docs/resources/Guild.md +++ b/docs/resources/Guild.md @@ -520,7 +520,7 @@ Giving the member a role will bypass Membership Screening as well as the guild's | ---------------- | ------- | ------------------------ | | KEYWORD_FILTER | 1 | filter of specific words | -###### AutoMod Event Types +###### AutoMod Rule Event Types | Type | Value | Description | | ---------------- | ------- | ---------------------------------------- | From a3c916a2c454d780069785c4885bdd240f4d10a3 Mon Sep 17 00:00:00 2001 From: MateoDeveloper Date: Mon, 16 May 2022 12:32:59 -0500 Subject: [PATCH 08/49] remove repeated/implied words --- docs/resources/Guild.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/resources/Guild.md b/docs/resources/Guild.md index 73d9c2fa71..38fefdf7e0 100644 --- a/docs/resources/Guild.md +++ b/docs/resources/Guild.md @@ -502,17 +502,17 @@ Giving the member a role will bypass Membership Screening as well as the guild's ###### AutoMod Rule Structure -| Field | Type | Description | -| ---------------- | ------------------- | ------------------------------------------------------------------------------------------------------ | -| name | string | the auto-mod rule name | -| trigger_type | integer | the auto-mod rule [trigger type](#DOCS_RESOURCES_GUILD/automod-rule-object-automod-rule-trigger-types) | -| event_type | integer | the auto-mod rule [event type](#DOCS_RESOURCES_GUILD/automod-rule-object-automod-rule-event-types) | -| actions | array | the auto-mod rule [actions](#DOCS_RESOURCES_GUILD/automod-rule-object-automod-rule-actions) | -| trigger_metadata | object | the auto-mod rule keywords, up to 1000 | -| enabled | boolean | whether the auto-mod rule is enabled | -| exempt_roles | array of snowflakes | the role ids that should not be affected by the rule | -| exempt_channels | array of snowflakes | the channel ids that should not be affected by the rule | -| position | integer | the auto-mod rule position between all the rules | +| Field | Type | Description | +| ---------------- | ------------------- | --------------------------------------------------------------------------------------------- | +| name | string | the rule name | +| trigger_type | integer | the rule [trigger type](#DOCS_RESOURCES_GUILD/automod-rule-object-automod-rule-trigger-types) | +| event_type | integer | the rule [event type](#DOCS_RESOURCES_GUILD/automod-rule-object-automod-rule-event-types) | +| actions | array | the rule [actions](#DOCS_RESOURCES_GUILD/automod-rule-object-automod-rule-actions) | +| trigger_metadata | object | the rule keywords, up to 1000 | +| enabled | boolean | whether the rule is enabled | +| exempt_roles | array of snowflakes | the role ids that should not be affected by the rule | +| exempt_channels | array of snowflakes | the channel ids that should not be affected by the rule | +| position | integer | the rule position between all the rules | ###### AutoMod Rule Trigger Types From 5de67fd2b9d49c3d225d40d7f252a5cdd15d8eb8 Mon Sep 17 00:00:00 2001 From: Hemu <1871299+hemu@users.noreply.github.com> Date: Wed, 18 May 2022 20:56:30 -0400 Subject: [PATCH 09/49] move auto moderation to separate resource and add gateway events --- docs/resources/Auto_Moderation.md | 93 +++++++++++++++++++++++++++++++ docs/resources/Guild.md | 60 +------------------- docs/topics/Gateway.md | 31 +++++++++++ 3 files changed, 125 insertions(+), 59 deletions(-) create mode 100644 docs/resources/Auto_Moderation.md diff --git a/docs/resources/Auto_Moderation.md b/docs/resources/Auto_Moderation.md new file mode 100644 index 0000000000..8ee48931cc --- /dev/null +++ b/docs/resources/Auto_Moderation.md @@ -0,0 +1,93 @@ +# Auto Moderation + +Auto Moderation is a per [guild](#DOCS_RESOURCES_GUILD/) feature which allows the configuration of a set of rules +to trigger based on some criteria, e.g. a message contains a specific keyword. Certain actions, such as blocking a message, +can be setup to automatically execute whenever a rule is triggered. + +### Auto Moderation Rule Object + +###### Auto Moderation Rule Structure + +| Field | Type | Description | +| ---------------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------- | +| name | string | the name | +| event_type | integer | the [event type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-event-types) | +| trigger_type | integer | the [trigger type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types) | +| trigger_metadata | object | the [trigger metadata](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types) | +| actions | array | the [actions](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object) which will execute when rule is triggered | +| enabled | boolean | whether the rule is enabled | +| exempt_roles | array of snowflakes | the role ids that should not be affected by the rule | +| exempt_channels | array of snowflakes | the channel ids that should not be affected by the rule | + +###### Example Auto Moderation Rule + +```json +{ + "name": "Keyword Filter 1", + "trigger_type": 1, + "event_type": 1, + "actions": [ + { + "type": 1, + "metadata": {} + }, + { + "type": 2, + "metadata": { "channel_id": "123456789123456789"} + } + ], + "trigger_metadata": { + "keyword_filter": ["cat*", "*cat", "*ana*"] + }, + "enabled": true, + "exempt_roles": ["323456789123456789", "423456789123456789"], + "exempt_channels": ["523456789123456789"], +} +``` + +###### Trigger Types + +Characterizes what type of information will be checked to determine whether a rule is triggered. + +| Type | Value | Description | +| ---------------- | ------- | --------------------------------------------------------------------------------- | +| KEYWORDS | 1 | check if any words from a user defined list of keywords exist in content | +| HARMFUL_LINKS | 2 | check if any known harmful links exist in content | +| SPAM | 3 | check if content represents generic spam | +| DEFAULT_KEYWORD_LIST | 4 | check if any words from built in pre-determined lists of words exist in content | + + +###### Trigger Metadata + +Additional data needed to figure out whether a rule should be triggered. Different fields are relevant based on the +value of [trigger_type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types). + +**TODO** + +###### Event Types + +Indicates in what event context a rule should be checked. + +| Type | Value | Description | +| ---------------- | ------- | ---------------------------------------- | +| MESSAGE_SEND | 1 | when a member sends a message on a guild | + + +### Auto Moderation Action Object + +An action which will execute whenever a rule is triggered. + +###### Auto Moderation Action Structure + +| Field | Type | Description | +| ------------------------- | ----------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | +| action_type | [action type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object-action-types) | the type of action | +| metadata | **TODO** | additional metadata needed during execution for this specific action type | + + +###### Action Types + +| Type | Value | Description | +| ------------------ | ------- | --------------------------------------------------------------- | +| BLOCK_MESSAGE | 1 | blocks the content of a message according to the rule | +| LOG_TO_CHANNEL | 2 | records original message in a specified channel | diff --git a/docs/resources/Guild.md b/docs/resources/Guild.md index 38fefdf7e0..92d4bc259e 100644 --- a/docs/resources/Guild.md +++ b/docs/resources/Guild.md @@ -122,6 +122,7 @@ Guilds in Discord represent an isolated collection of users and channels, and ar | -------------------------------- | ------------------------------------------------------------------------------------------------------------------- | | ANIMATED_BANNER | guild has access to set an animated guild banner image | | ANIMATED_ICON | guild has access to set an animated guild icon | +| AUTO_MODERATION | guild has access to auto moderation system and has setup at least one rule | | BANNER | guild has access to set a guild banner image | | COMMERCE | guild has access to use commerce features (i.e. create store channels) | | COMMUNITY | guild can enable welcome screen, Membership Screening, stage channels and discovery, and receives community updates | @@ -141,7 +142,6 @@ Guilds in Discord represent an isolated collection of users and channels, and ar | VERIFIED | guild is verified | | VIP_REGIONS | guild has access to set 384kbps bitrate in voice (previously VIP voice servers) | | WELCOME_SCREEN_ENABLED | guild has enabled the welcome screen | -| AUTO_MODERATION | guild has enabled the auto moderation system | ###### Example Guild @@ -498,64 +498,6 @@ Giving the member a role will bypass Membership Screening as well as the guild's > warn > We are making significant changes to the Membership Screening API specifically related to getting and editing the Membership Screening object. Long story short is that it can be improved. As such, we have removed those documentation. There will **not be** any changes to how pending members work, as outlined above. That behavior will stay the same. -### AutoMod Rule Object - -###### AutoMod Rule Structure - -| Field | Type | Description | -| ---------------- | ------------------- | --------------------------------------------------------------------------------------------- | -| name | string | the rule name | -| trigger_type | integer | the rule [trigger type](#DOCS_RESOURCES_GUILD/automod-rule-object-automod-rule-trigger-types) | -| event_type | integer | the rule [event type](#DOCS_RESOURCES_GUILD/automod-rule-object-automod-rule-event-types) | -| actions | array | the rule [actions](#DOCS_RESOURCES_GUILD/automod-rule-object-automod-rule-actions) | -| trigger_metadata | object | the rule keywords, up to 1000 | -| enabled | boolean | whether the rule is enabled | -| exempt_roles | array of snowflakes | the role ids that should not be affected by the rule | -| exempt_channels | array of snowflakes | the channel ids that should not be affected by the rule | -| position | integer | the rule position between all the rules | - -###### AutoMod Rule Trigger Types - -| Type | Value | Description | -| ---------------- | ------- | ------------------------ | -| KEYWORD_FILTER | 1 | filter of specific words | - -###### AutoMod Rule Event Types - -| Type | Value | Description | -| ---------------- | ------- | ---------------------------------------- | -| MESSAGE_SEND | 1 | when a member sends a message on a guild | - -###### AutoMod Rule Actions - -| Type | Value | Description | -| ---------------- | ------- | ----------------------------------------------------- | -| BLOCK_MESSAGE | 1 | blocks the content of a message according to the rule | -| SEND_AN_ALERT | 2 | sends an alert with the message to a specific channel | - -###### Example AutoMod Rule - -```json -{ - "name": "Keyword Filter 1", - "trigger_type": 1, - "event_type": 1, - "actions": [ - { - "type": 1, - "metadata": {} - } - ], - "trigger_metadata": { - "keyword_filter": ["cat*", "*cat", "*ana*"] - }, - "enabled": true, - "exempt_roles": [], - "exempt_channels": [], - "position": 0 -} -``` - ## Create Guild % POST /guilds Create a new guild. Returns a [guild](#DOCS_RESOURCES_GUILD/guild-object) object on success. Fires a [Guild Create](#DOCS_TOPICS_GATEWAY/guild-create) Gateway event. diff --git a/docs/topics/Gateway.md b/docs/topics/Gateway.md index 89381c885f..78210818c3 100644 --- a/docs/topics/Gateway.md +++ b/docs/topics/Gateway.md @@ -314,6 +314,15 @@ GUILD_SCHEDULED_EVENTS (1 << 16) - GUILD_SCHEDULED_EVENT_DELETE - GUILD_SCHEDULED_EVENT_USER_ADD - GUILD_SCHEDULED_EVENT_USER_REMOVE + +AUTO_MODERATION_CONFIGURATION (1 << 20) + - AUTO_MODERATION_RULE_CREATE + - AUTO_MODERATION_RULE_UPDATE + - AUTO_MODERATION_RULE_DELETE + +AUTO_MODERATION_EXECUTION (1 << 21) + - AUTO_MODERATION_ACTION_EXECUTION + ``` \* [Thread Members Update](#DOCS_TOPICS_GATEWAY/thread-members-update) contains different data depending on which intents are used. @@ -494,6 +503,10 @@ Events are payloads sent over the socket to a client that correspond to events i | [Reconnect](#DOCS_TOPICS_GATEWAY/reconnect) | server is going away, client should reconnect to gateway and resume | | [Invalid Session](#DOCS_TOPICS_GATEWAY/invalid-session) | failure response to [Identify](#DOCS_TOPICS_GATEWAY/identify) or [Resume](#DOCS_TOPICS_GATEWAY/resume) or invalid active session | | [Application Command Permissions Update](#DOCS_TOPICS_GATEWAY/application-command-permissions-update) | application command permission was updated | +| [Auto Moderation Rule Create](#DOCS_TOPICS_GATEWAY/auto-moderation-rule-create) | auto moderation rule was created | +| [Auto Moderation Rule Update](#DOCS_TOPICS_GATEWAY/auto-moderation-rule-update) | auto moderation rule was updated | +| [Auto Moderation Rule Delete](#DOCS_TOPICS_GATEWAY/auto-moderation-rule-delete) | auto moderation rule was deleted | +| [Auto Moderation Action Execution](#DOCS_TOPICS_GATEWAY/auto-moderation-action-execution) | auto moderation rule was triggered and an action executed (e.g. a message was blocked) | | [Channel Create](#DOCS_TOPICS_GATEWAY/channel-create) | new guild channel created | | [Channel Update](#DOCS_TOPICS_GATEWAY/channel-update) | channel was updated | | [Channel Delete](#DOCS_TOPICS_GATEWAY/channel-delete) | channel was deleted | @@ -833,6 +846,24 @@ The inner `d` key is a boolean that indicates whether the session may be resumab `APPLICATION_COMMAND_PERMISSIONS_UPDATE` event, sent when an application command's permissions are updated. The inner payload is an [application command permissions](#DOCS_INTERACTIONS_APPLICATION_COMMANDS/application-command-permissions-object-guild-application-command-permissions-structure) object. +### Auto Moderation + +#### Auto Moderation Rule Create + +Sent when a rule is created. The inner payload is an [auto moderation rule](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object) object. + +#### Auto Moderation Rule Update + +Sent when a rule is updated. The inner payload is an [auto moderation rule](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object) object. + +#### Auto Moderation Rule Delete + +Sent when a rule is deleted. The inner payload is an [auto moderation rule](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object) object. + +#### Auto Moderation Action Execution + +Sent when an rule is triggered and an action is executed (e.g. message is blocked). The inner payload is an [auto moderation action](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object) object. + ### Channels #### Channel Create From aacb8cabc5cfc30109c8b8a232056240a6b6534e Mon Sep 17 00:00:00 2001 From: Hemu <1871299+hemu@users.noreply.github.com> Date: Wed, 18 May 2022 21:06:11 -0400 Subject: [PATCH 10/49] fix rule obj link in audit log --- docs/resources/Audit_Log.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/resources/Audit_Log.md b/docs/resources/Audit_Log.md index 2226dc5406..07b11b5777 100644 --- a/docs/resources/Audit_Log.md +++ b/docs/resources/Audit_Log.md @@ -120,9 +120,9 @@ If no object is noted, there won't be a `changes` array in the entry, though oth | THREAD_UPDATE | 111 | Thread was updated | [Thread](#DOCS_RESOURCES_CHANNEL/thread-metadata-object) | | THREAD_DELETE | 112 | Thread was deleted | [Thread](#DOCS_RESOURCES_CHANNEL/thread-metadata-object) | | APPLICATION_COMMAND_PERMISSION_UPDATE | 121 | Permissions were updated for a command | [Command Permission](#DOCS_INTERACTIONS_APPLICATION_COMMANDS/application-command-permissions-object-application-command-permissions-structure)\* | -| AUTO_MODERATION_RULE_CREATE | 140 | AutoMod rule was created | [AutoMod Rule](#DOCS_RESOURCES_GUILD/automod-rule-object) | -| AUTO_MODERATION_RULE_UPDATE | 141 | AutoMod rule was updated | [AutoMod Rule](#DOCS_RESOURCES_GUILD/automod-rule-object) | -| AUTO_MODERATION_RULE_DELETE | 142 | AutoMod rule was deleted | [AutoMod Rule](#DOCS_RESOURCES_GUILD/automod-rule-object) | +| AUTO_MODERATION_RULE_CREATE | 140 | AutoMod rule was created | [Auto Moderation Rule](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object) | +| AUTO_MODERATION_RULE_UPDATE | 141 | AutoMod rule was updated | [Auto Moderation Rule](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object) | +| AUTO_MODERATION_RULE_DELETE | 142 | AutoMod rule was deleted | [Auto Moderation Rule](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object) | | AUTO_MODERATION_BLOCK_MESSAGE | 143 | Message was blocked by AutoMod (according to a rule) | | \* Object has exception(s) to available keys. See the [exceptions](#DOCS_RESOURCES_AUDIT_LOG/audit-log-change-object-audit-log-change-exceptions) section below for details. From 60e688c05a8ed4eaa23437bdd320fedb296b6521 Mon Sep 17 00:00:00 2001 From: Hemu <1871299+hemu@users.noreply.github.com> Date: Wed, 18 May 2022 21:15:02 -0400 Subject: [PATCH 11/49] add permission requirements --- docs/resources/Auto_Moderation.md | 7 ++++++- docs/topics/Gateway.md | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/resources/Auto_Moderation.md b/docs/resources/Auto_Moderation.md index 8ee48931cc..d684db93f9 100644 --- a/docs/resources/Auto_Moderation.md +++ b/docs/resources/Auto_Moderation.md @@ -81,7 +81,7 @@ An action which will execute whenever a rule is triggered. | Field | Type | Description | | ------------------------- | ----------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | -| action_type | [action type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object-action-types) | the type of action | +| type | [action type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object-action-types) | the type of action | | metadata | **TODO** | additional metadata needed during execution for this specific action type | @@ -91,3 +91,8 @@ An action which will execute whenever a rule is triggered. | ------------------ | ------- | --------------------------------------------------------------- | | BLOCK_MESSAGE | 1 | blocks the content of a message according to the rule | | LOG_TO_CHANNEL | 2 | records original message in a specified channel | + + +### Auto Moderation Permissions Requirements + +Users are required to have the `MANAGE_GUILD` permission to access all Auto Moderation resources. diff --git a/docs/topics/Gateway.md b/docs/topics/Gateway.md index 78210818c3..8d5142f96f 100644 --- a/docs/topics/Gateway.md +++ b/docs/topics/Gateway.md @@ -848,6 +848,8 @@ The inner `d` key is a boolean that indicates whether the session may be resumab ### Auto Moderation +All auto moderation related events are currently only sent to bot users which have the `MANAGE_GUILD` permission. + #### Auto Moderation Rule Create Sent when a rule is created. The inner payload is an [auto moderation rule](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object) object. From 7d338914b1823ada69416e12a2503092c897ce81 Mon Sep 17 00:00:00 2001 From: MateoDeveloper <79017590+Mateo-tem@users.noreply.github.com> Date: Wed, 18 May 2022 20:49:39 -0500 Subject: [PATCH 12/49] fix AUTO_MODERATION guild feature description Co-authored-by: advaith --- docs/resources/Guild.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/resources/Guild.md b/docs/resources/Guild.md index 92d4bc259e..c18f64994d 100644 --- a/docs/resources/Guild.md +++ b/docs/resources/Guild.md @@ -122,7 +122,7 @@ Guilds in Discord represent an isolated collection of users and channels, and ar | -------------------------------- | ------------------------------------------------------------------------------------------------------------------- | | ANIMATED_BANNER | guild has access to set an animated guild banner image | | ANIMATED_ICON | guild has access to set an animated guild icon | -| AUTO_MODERATION | guild has access to auto moderation system and has setup at least one rule | +| AUTO_MODERATION | guild has set up auto moderation rules | | BANNER | guild has access to set a guild banner image | | COMMERCE | guild has access to use commerce features (i.e. create store channels) | | COMMUNITY | guild can enable welcome screen, Membership Screening, stage channels and discovery, and receives community updates | From edfafc6526348ebc7ad5e5f19602ed9e01d5d60f Mon Sep 17 00:00:00 2001 From: MateoDeveloper <79017590+Mateo-tem@users.noreply.github.com> Date: Wed, 18 May 2022 20:54:37 -0500 Subject: [PATCH 13/49] add missing word on Auto Moderation Gateway Events Co-authored-by: advaith --- docs/topics/Gateway.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/topics/Gateway.md b/docs/topics/Gateway.md index 8d5142f96f..a028dd0952 100644 --- a/docs/topics/Gateway.md +++ b/docs/topics/Gateway.md @@ -506,7 +506,7 @@ Events are payloads sent over the socket to a client that correspond to events i | [Auto Moderation Rule Create](#DOCS_TOPICS_GATEWAY/auto-moderation-rule-create) | auto moderation rule was created | | [Auto Moderation Rule Update](#DOCS_TOPICS_GATEWAY/auto-moderation-rule-update) | auto moderation rule was updated | | [Auto Moderation Rule Delete](#DOCS_TOPICS_GATEWAY/auto-moderation-rule-delete) | auto moderation rule was deleted | -| [Auto Moderation Action Execution](#DOCS_TOPICS_GATEWAY/auto-moderation-action-execution) | auto moderation rule was triggered and an action executed (e.g. a message was blocked) | +| [Auto Moderation Action Execution](#DOCS_TOPICS_GATEWAY/auto-moderation-action-execution) | auto moderation rule was triggered and an action was executed (e.g. a message was blocked) | | [Channel Create](#DOCS_TOPICS_GATEWAY/channel-create) | new guild channel created | | [Channel Update](#DOCS_TOPICS_GATEWAY/channel-update) | channel was updated | | [Channel Delete](#DOCS_TOPICS_GATEWAY/channel-delete) | channel was deleted | From 0cb7bcbe8a81db33bee83dd8e22ebaa938e843ea Mon Sep 17 00:00:00 2001 From: MateoDeveloper <79017590+Mateo-tem@users.noreply.github.com> Date: Wed, 18 May 2022 20:55:09 -0500 Subject: [PATCH 14/49] add table formatting Co-authored-by: advaith --- docs/resources/Auto_Moderation.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/resources/Auto_Moderation.md b/docs/resources/Auto_Moderation.md index d684db93f9..18a64f878b 100644 --- a/docs/resources/Auto_Moderation.md +++ b/docs/resources/Auto_Moderation.md @@ -49,12 +49,12 @@ can be setup to automatically execute whenever a rule is triggered. Characterizes what type of information will be checked to determine whether a rule is triggered. -| Type | Value | Description | -| ---------------- | ------- | --------------------------------------------------------------------------------- | -| KEYWORDS | 1 | check if any words from a user defined list of keywords exist in content | -| HARMFUL_LINKS | 2 | check if any known harmful links exist in content | -| SPAM | 3 | check if content represents generic spam | -| DEFAULT_KEYWORD_LIST | 4 | check if any words from built in pre-determined lists of words exist in content | +| Type | Value | Description | +| -------------------- | ------- | ------------------------------------------------------------------------------- | +| KEYWORDS | 1 | check if any words from a user defined list of keywords exist in content | +| HARMFUL_LINKS | 2 | check if any known harmful links exist in content | +| SPAM | 3 | check if content represents generic spam | +| DEFAULT_KEYWORD_LIST | 4 | check if any words from built in pre-determined lists of words exist in content | ###### Trigger Metadata From fa25ce3bec6e47faac695500f4bdbd84d1d24e6c Mon Sep 17 00:00:00 2001 From: Mateo Date: Wed, 18 May 2022 21:06:03 -0500 Subject: [PATCH 15/49] Audit Log Events: use Auto Moderation instead of AutoMod --- docs/resources/Audit_Log.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/resources/Audit_Log.md b/docs/resources/Audit_Log.md index 07b11b5777..b965c2c909 100644 --- a/docs/resources/Audit_Log.md +++ b/docs/resources/Audit_Log.md @@ -120,9 +120,9 @@ If no object is noted, there won't be a `changes` array in the entry, though oth | THREAD_UPDATE | 111 | Thread was updated | [Thread](#DOCS_RESOURCES_CHANNEL/thread-metadata-object) | | THREAD_DELETE | 112 | Thread was deleted | [Thread](#DOCS_RESOURCES_CHANNEL/thread-metadata-object) | | APPLICATION_COMMAND_PERMISSION_UPDATE | 121 | Permissions were updated for a command | [Command Permission](#DOCS_INTERACTIONS_APPLICATION_COMMANDS/application-command-permissions-object-application-command-permissions-structure)\* | -| AUTO_MODERATION_RULE_CREATE | 140 | AutoMod rule was created | [Auto Moderation Rule](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object) | -| AUTO_MODERATION_RULE_UPDATE | 141 | AutoMod rule was updated | [Auto Moderation Rule](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object) | -| AUTO_MODERATION_RULE_DELETE | 142 | AutoMod rule was deleted | [Auto Moderation Rule](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object) | +| AUTO_MODERATION_RULE_CREATE | 140 | Auto Moderation rule was created | [Auto Moderation Rule](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object) | +| AUTO_MODERATION_RULE_UPDATE | 141 | Auto Moderation rule was updated | [Auto Moderation Rule](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object) | +| AUTO_MODERATION_RULE_DELETE | 142 | Auto Moderation rule was deleted | [Auto Moderation Rule](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object) | | AUTO_MODERATION_BLOCK_MESSAGE | 143 | Message was blocked by AutoMod (according to a rule) | | \* Object has exception(s) to available keys. See the [exceptions](#DOCS_RESOURCES_AUDIT_LOG/audit-log-change-object-audit-log-change-exceptions) section below for details. From 9504ac389c92b1dfd3a1a6560b9e5b11c16df165 Mon Sep 17 00:00:00 2001 From: Hemu <1871299+hemu@users.noreply.github.com> Date: Thu, 19 May 2022 09:53:13 -0400 Subject: [PATCH 16/49] Add param constraints Co-authored-by: Jupith <51760248+Jupith@users.noreply.github.com> --- docs/resources/Auto_Moderation.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/resources/Auto_Moderation.md b/docs/resources/Auto_Moderation.md index 18a64f878b..0045068e6b 100644 --- a/docs/resources/Auto_Moderation.md +++ b/docs/resources/Auto_Moderation.md @@ -16,8 +16,8 @@ can be setup to automatically execute whenever a rule is triggered. | trigger_metadata | object | the [trigger metadata](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types) | | actions | array | the [actions](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object) which will execute when rule is triggered | | enabled | boolean | whether the rule is enabled | -| exempt_roles | array of snowflakes | the role ids that should not be affected by the rule | -| exempt_channels | array of snowflakes | the channel ids that should not be affected by the rule | +| exempt_roles | array of snowflakes | the role ids that should not be affected by the rule (Maximum of 20) | +| exempt_channels | array of snowflakes | the channel ids that should not be affected by the rule (Maximum of 50) | ###### Example Auto Moderation Rule @@ -56,7 +56,8 @@ Characterizes what type of information will be checked to determine whether a ru | SPAM | 3 | check if content represents generic spam | | DEFAULT_KEYWORD_LIST | 4 | check if any words from built in pre-determined lists of words exist in content | - +> info +> Automod rules are limited to 1 rule per trigger type, with the exception of `KEYWORDS` which can have multiple. ###### Trigger Metadata Additional data needed to figure out whether a rule should be triggered. Different fields are relevant based on the From 92bf59001514d9c792e7786efb6e3dcae8da14bf Mon Sep 17 00:00:00 2001 From: Hemu <1871299+hemu@users.noreply.github.com> Date: Thu, 19 May 2022 13:15:06 -0400 Subject: [PATCH 17/49] add api routes --- docs/resources/Auto_Moderation.md | 70 ++++++++++++++++++++++++++++++- 1 file changed, 68 insertions(+), 2 deletions(-) diff --git a/docs/resources/Auto_Moderation.md b/docs/resources/Auto_Moderation.md index 0045068e6b..12a955d0f0 100644 --- a/docs/resources/Auto_Moderation.md +++ b/docs/resources/Auto_Moderation.md @@ -56,8 +56,6 @@ Characterizes what type of information will be checked to determine whether a ru | SPAM | 3 | check if content represents generic spam | | DEFAULT_KEYWORD_LIST | 4 | check if any words from built in pre-determined lists of words exist in content | -> info -> Automod rules are limited to 1 rule per trigger type, with the exception of `KEYWORDS` which can have multiple. ###### Trigger Metadata Additional data needed to figure out whether a rule should be triggered. Different fields are relevant based on the @@ -97,3 +95,71 @@ An action which will execute whenever a rule is triggered. ### Auto Moderation Permissions Requirements Users are required to have the `MANAGE_GUILD` permission to access all Auto Moderation resources. + +### Auto Moderation Limits Per Trigger Type + +Users are required to have the `MANAGE_GUILD` permission to access all Auto Moderation resources. + +| Type | Max Per Guild | +| -------------------- | ------------- | +| KEYWORDS | 3 | +| HARMFUL_LINKS | 1 | +| SPAM | 1 | +| DEFAULT_KEYWORD_LIST | 1 | + +## List Auto Moderation Rules for Guild % GET /guilds/{guild.id#DOCS_RESOURCES_GUILD/guild-object}/auto-moderation/rules + +Get a list of all rules curerntly configured for guild. Returns a list of [auto moderation rule](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object) objects for the given guild. + +> info +> Requires `MANAGE_GUILD` [permissions](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-permission-requirements) + +## Get Auto Moderation Rule % GET /guilds/{guild.id#DOCS_RESOURCES_GUILD/guild-object}/auto-moderation/rules/{auto_moderation_rule.id#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object} + +Get a single rule. Returns an [auto moderation rule](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object) object. + +> info +> Requires `MANAGE_GUILD` [permissions](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-permission-requirements) + +## Create Auto Moderation Rule % POST /guilds/{guild.id#DOCS_RESOURCES_GUILD/guild-object}/auto-moderation/rules + +Create a new rule. Returns an [auto moderation rule](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object) on success. + +> info +> Requires `MANAGE_GUILD` [permissions](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-permission-requirements) + +**TODO** +Add params + +###### JSON Params + +| Field | Type | Description | +| ---------------------- | --------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ | + +> info +> See [Auto Moderation Limits Per Trigger Type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-limits-per-trigger-type) for limits on how many rules of each trigger type can be created per guild. + + +## Modify Auto Moderation Rule % PATCH /guilds/{guild.id#DOCS_RESOURCES_GUILD/guild-object}/auto-moderation/rules/{auto_moderation_rule.id#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object} + +Modify an existing rule. Returns an [auto moderation rule](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object) on success. + +> info +> Requires `MANAGE_GUILD` [permissions](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-permission-requirements) + +**TODO** +Add params + +###### JSON Params + +| Field | Type | Description | +| ---------------------- | --------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ | + +## Delete Auto Moderation Rule % DELETE /guilds/{guild.id#DOCS_RESOURCES_GUILD/guild-object}/auto-moderation/rules/{auto_moderation_rule.id#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object} + +Delete a rule. Returns a `204` on success. + +> info +> Requires `MANAGE_GUILD` [permissions](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-permission-requirements) + + From eaa3ee9c399c0999182d5b0f6edcb99f57a21865 Mon Sep 17 00:00:00 2001 From: Mateo Date: Thu, 19 May 2022 14:15:39 -0500 Subject: [PATCH 18/49] add id field in rule object and table formatting --- docs/resources/Auto_Moderation.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/resources/Auto_Moderation.md b/docs/resources/Auto_Moderation.md index 12a955d0f0..55bcf1a01f 100644 --- a/docs/resources/Auto_Moderation.md +++ b/docs/resources/Auto_Moderation.md @@ -10,19 +10,21 @@ can be setup to automatically execute whenever a rule is triggered. | Field | Type | Description | | ---------------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------- | +| id | snowflake | the id of this rule | | name | string | the name | | event_type | integer | the [event type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-event-types) | | trigger_type | integer | the [trigger type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types) | | trigger_metadata | object | the [trigger metadata](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types) | | actions | array | the [actions](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object) which will execute when rule is triggered | | enabled | boolean | whether the rule is enabled | -| exempt_roles | array of snowflakes | the role ids that should not be affected by the rule (Maximum of 20) | -| exempt_channels | array of snowflakes | the channel ids that should not be affected by the rule (Maximum of 50) | +| exempt_roles | array of snowflakes | the role ids that should not be affected by the rule (Maximum of 20) | +| exempt_channels | array of snowflakes | the channel ids that should not be affected by the rule (Maximum of 50) | ###### Example Auto Moderation Rule ```json { + "id": "969707018069872670", "name": "Keyword Filter 1", "trigger_type": 1, "event_type": 1, From fa83ac153b4772b5ced8e20696134f1d521d61b3 Mon Sep 17 00:00:00 2001 From: Mateo Date: Thu, 19 May 2022 14:20:03 -0500 Subject: [PATCH 19/49] fix links of permission requirements --- docs/resources/Auto_Moderation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/resources/Auto_Moderation.md b/docs/resources/Auto_Moderation.md index 55bcf1a01f..4a4ea9bf48 100644 --- a/docs/resources/Auto_Moderation.md +++ b/docs/resources/Auto_Moderation.md @@ -94,7 +94,7 @@ An action which will execute whenever a rule is triggered. | LOG_TO_CHANNEL | 2 | records original message in a specified channel | -### Auto Moderation Permissions Requirements +### Auto Moderation Permission Requirements Users are required to have the `MANAGE_GUILD` permission to access all Auto Moderation resources. From 51265ebd588398109908718f3c33f1f77fc64cc1 Mon Sep 17 00:00:00 2001 From: Mateo Date: Thu, 19 May 2022 14:23:25 -0500 Subject: [PATCH 20/49] fix little error in example of rule --- docs/resources/Auto_Moderation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/resources/Auto_Moderation.md b/docs/resources/Auto_Moderation.md index 4a4ea9bf48..1fffd3f112 100644 --- a/docs/resources/Auto_Moderation.md +++ b/docs/resources/Auto_Moderation.md @@ -35,7 +35,7 @@ can be setup to automatically execute whenever a rule is triggered. }, { "type": 2, - "metadata": { "channel_id": "123456789123456789"} + "metadata": { "channel_id": "123456789123456789" } } ], "trigger_metadata": { From 3c9ff2ae68fa491cf6027975175642a9fbd24627 Mon Sep 17 00:00:00 2001 From: Hemu <1871299+hemu@users.noreply.github.com> Date: Thu, 19 May 2022 17:15:56 -0400 Subject: [PATCH 21/49] add new audit log field, change action execution gw event, add additional rule fields --- docs/resources/Audit_Log.md | 9 +++++---- docs/resources/Auto_Moderation.md | 2 ++ docs/topics/Gateway.md | 9 +++++++++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/docs/resources/Audit_Log.md b/docs/resources/Audit_Log.md index b965c2c909..f44eb325bc 100644 --- a/docs/resources/Audit_Log.md +++ b/docs/resources/Audit_Log.md @@ -13,11 +13,12 @@ When an app is performing an eligible action using the APIs, it can pass an `X-A | Field | Type | Description | | ---------------------- | ------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------- | | audit_log_entries | array of [audit log entry](#DOCS_RESOURCES_AUDIT_LOG/audit-log-entry-object) objects | List of audit log entries, sorted from most to least recent | -| guild_scheduled_events | array of [guild scheduled event](#DOCS_RESOURCES_GUILD_SCHEDULED_EVENT/guild-scheduled-event-object) objects | List of guild scheduled events found in the audit log | +| auto_moderation_rules | array of [auto moderation rule](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object) objects | List of auto moderation rules referenced in the audit log | +| guild_scheduled_events | array of [guild scheduled event](#DOCS_RESOURCES_GUILD_SCHEDULED_EVENT/guild-scheduled-event-object) objects | List of guild scheduled events referenced in the audit log | | integrations | array of partial [integration](#DOCS_RESOURCES_GUILD/integration-object) objects | List of partial integration objects | -| threads | array of thread-specific [channel](#DOCS_RESOURCES_CHANNEL/channel-object) objects | List of threads found in the audit log\* | -| users | array of [user](#DOCS_RESOURCES_USER/user-object) objects | List of users found in the audit log | -| webhooks | array of [webhook](#DOCS_RESOURCES_WEBHOOK/webhook-object) objects | List of webhooks found in the audit log | +| threads | array of thread-specific [channel](#DOCS_RESOURCES_CHANNEL/channel-object) objects | List of threads referenced in the audit log\* | +| users | array of [user](#DOCS_RESOURCES_USER/user-object) objects | List of users referenced in the audit log | +| webhooks | array of [webhook](#DOCS_RESOURCES_WEBHOOK/webhook-object) objects | List of webhooks referenced in the audit log | \* Threads referenced in `THREAD_CREATE` and `THREAD_UPDATE` events are included in the threads map since archived threads might not be kept in memory by clients. diff --git a/docs/resources/Auto_Moderation.md b/docs/resources/Auto_Moderation.md index 1fffd3f112..718e62a68b 100644 --- a/docs/resources/Auto_Moderation.md +++ b/docs/resources/Auto_Moderation.md @@ -11,7 +11,9 @@ can be setup to automatically execute whenever a rule is triggered. | Field | Type | Description | | ---------------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------- | | id | snowflake | the id of this rule | +| guild_id | snowflake | the guild which the rule belongs to | | name | string | the name | +| creator_id | snowflake | the user which first created this rule | | event_type | integer | the [event type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-event-types) | | trigger_type | integer | the [trigger type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types) | | trigger_metadata | object | the [trigger metadata](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types) | diff --git a/docs/topics/Gateway.md b/docs/topics/Gateway.md index a028dd0952..bf0fcbd047 100644 --- a/docs/topics/Gateway.md +++ b/docs/topics/Gateway.md @@ -866,6 +866,15 @@ Sent when a rule is deleted. The inner payload is an [auto moderation rule](#DOC Sent when an rule is triggered and an action is executed (e.g. message is blocked). The inner payload is an [auto moderation action](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object) object. +###### Auto Moderation Action Execution Event Fields + +| Field | Type | Description | +| ------------------- | ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------- | +| action | [auto moderation action](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object) object | the action which was executed | +| guild_id | snowflake | the id of the guild in which action was executed | + +**TODO**: Add more fields which will be exposed here after they are finalized + ### Channels #### Channel Create From 2f8d62fc3e73b7e533d1abf074bd83d575466a38 Mon Sep 17 00:00:00 2001 From: Mateo Date: Thu, 19 May 2022 21:43:48 -0500 Subject: [PATCH 22/49] add guild_id and creator_id in example rule obj --- docs/resources/Auto_Moderation.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/resources/Auto_Moderation.md b/docs/resources/Auto_Moderation.md index 718e62a68b..f31100f32d 100644 --- a/docs/resources/Auto_Moderation.md +++ b/docs/resources/Auto_Moderation.md @@ -27,7 +27,9 @@ can be setup to automatically execute whenever a rule is triggered. ```json { "id": "969707018069872670", + "guild_id": "613425648685547541", "name": "Keyword Filter 1", + "creator_id": "423457898095789043", "trigger_type": 1, "event_type": 1, "actions": [ From 1f7fdfd6ada63e604ce69c8cdab0a23b2d993d27 Mon Sep 17 00:00:00 2001 From: Hemu <1871299+hemu@users.noreply.github.com> Date: Fri, 20 May 2022 17:13:55 -0400 Subject: [PATCH 23/49] add POST and PATCH params --- docs/resources/Auto_Moderation.md | 33 +++++++++++++++++++++---------- docs/topics/Gateway.md | 2 +- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/docs/resources/Auto_Moderation.md b/docs/resources/Auto_Moderation.md index f31100f32d..840f9a4ef3 100644 --- a/docs/resources/Auto_Moderation.md +++ b/docs/resources/Auto_Moderation.md @@ -134,13 +134,18 @@ Create a new rule. Returns an [auto moderation rule](#DOCS_RESOURCES_AUTO_MODERA > info > Requires `MANAGE_GUILD` [permissions](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-permission-requirements) -**TODO** -Add params - ###### JSON Params -| Field | Type | Description | -| ---------------------- | --------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ | +| Field | Type | Description | +| ---------------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------- | +| name | string | the name | +| event_type | integer | the [event type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-event-types) | +| trigger_type | integer | the [trigger type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types) | +| trigger_metadata | object | the [trigger metadata](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types) | +| actions | array | the [actions](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object) which will execute when rule is triggered | +| enabled? | boolean | whether the rule is enabled (False by default) | +| exempt_roles? | array of snowflakes | the role ids that should not be affected by the rule (Maximum of 20) | +| exempt_channels? | array of snowflakes | the channel ids that should not be affected by the rule (Maximum of 50) | > info > See [Auto Moderation Limits Per Trigger Type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-limits-per-trigger-type) for limits on how many rules of each trigger type can be created per guild. @@ -151,15 +156,23 @@ Add params Modify an existing rule. Returns an [auto moderation rule](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object) on success. > info -> Requires `MANAGE_GUILD` [permissions](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-permission-requirements) +> Requires `MANAGE_GUILD` [permissions](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-permission-requirements). -**TODO** -Add params +> info +> All parameters for this endpoint are optional. ###### JSON Params -| Field | Type | Description | -| ---------------------- | --------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ | +| Field | Type | Description | +| ---------------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------- | +| name | string | the name | +| event_type | integer | the [event type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-event-types) | +| trigger_metadata | object | the [trigger metadata](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types) | +| actions | array | the [actions](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object) which will execute when rule is triggered | +| enabled | boolean | whether the rule is enabled | +| exempt_roles | array of snowflakes | the role ids that should not be affected by the rule (Maximum of 20) | +| exempt_channels | array of snowflakes | the channel ids that should not be affected by the rule (Maximum of 50) | + ## Delete Auto Moderation Rule % DELETE /guilds/{guild.id#DOCS_RESOURCES_GUILD/guild-object}/auto-moderation/rules/{auto_moderation_rule.id#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object} diff --git a/docs/topics/Gateway.md b/docs/topics/Gateway.md index bf0fcbd047..e7071f399e 100644 --- a/docs/topics/Gateway.md +++ b/docs/topics/Gateway.md @@ -864,7 +864,7 @@ Sent when a rule is deleted. The inner payload is an [auto moderation rule](#DOC #### Auto Moderation Action Execution -Sent when an rule is triggered and an action is executed (e.g. message is blocked). The inner payload is an [auto moderation action](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object) object. +Sent when an rule is triggered and an action is executed (e.g. message is blocked). ###### Auto Moderation Action Execution Event Fields From cf1cea28fa165e8e3ed6b4dd4c67166efaf8e5cd Mon Sep 17 00:00:00 2001 From: MateoDeveloper <79017590+Mateo-tem@users.noreply.github.com> Date: Fri, 20 May 2022 19:29:22 -0500 Subject: [PATCH 24/49] fix typo in List Auto Moderation Rules for Guild Co-authored-by: Bryan Fernandes <45880040+Smidul@users.noreply.github.com> --- docs/resources/Auto_Moderation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/resources/Auto_Moderation.md b/docs/resources/Auto_Moderation.md index 840f9a4ef3..a4e912b224 100644 --- a/docs/resources/Auto_Moderation.md +++ b/docs/resources/Auto_Moderation.md @@ -115,7 +115,7 @@ Users are required to have the `MANAGE_GUILD` permission to access all Auto Mode ## List Auto Moderation Rules for Guild % GET /guilds/{guild.id#DOCS_RESOURCES_GUILD/guild-object}/auto-moderation/rules -Get a list of all rules curerntly configured for guild. Returns a list of [auto moderation rule](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object) objects for the given guild. +Get a list of all rules currently configured for guild. Returns a list of [auto moderation rule](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object) objects for the given guild. > info > Requires `MANAGE_GUILD` [permissions](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-permission-requirements) From 43c8ef36d37c1fcad9e8ace5b1205100480fee9c Mon Sep 17 00:00:00 2001 From: MateoDeveloper <79017590+Mateo-tem@users.noreply.github.com> Date: Mon, 23 May 2022 16:46:19 -0500 Subject: [PATCH 25/49] fix guild_id description in rule obj Co-authored-by: Vitor --- docs/resources/Auto_Moderation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/resources/Auto_Moderation.md b/docs/resources/Auto_Moderation.md index a4e912b224..811382e8d6 100644 --- a/docs/resources/Auto_Moderation.md +++ b/docs/resources/Auto_Moderation.md @@ -11,7 +11,7 @@ can be setup to automatically execute whenever a rule is triggered. | Field | Type | Description | | ---------------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------- | | id | snowflake | the id of this rule | -| guild_id | snowflake | the guild which the rule belongs to | +| guild_id | snowflake | the guild which this rule belongs to | | name | string | the name | | creator_id | snowflake | the user which first created this rule | | event_type | integer | the [event type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-event-types) | From 887e0395486e5866aecd68d4ea12d812688d7212 Mon Sep 17 00:00:00 2001 From: Mateo Date: Mon, 23 May 2022 16:52:01 -0500 Subject: [PATCH 26/49] fix descriptions in fields of rule obj --- docs/resources/Auto_Moderation.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/resources/Auto_Moderation.md b/docs/resources/Auto_Moderation.md index 811382e8d6..463ab79d7f 100644 --- a/docs/resources/Auto_Moderation.md +++ b/docs/resources/Auto_Moderation.md @@ -8,19 +8,19 @@ can be setup to automatically execute whenever a rule is triggered. ###### Auto Moderation Rule Structure -| Field | Type | Description | -| ---------------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------- | -| id | snowflake | the id of this rule | -| guild_id | snowflake | the guild which this rule belongs to | -| name | string | the name | -| creator_id | snowflake | the user which first created this rule | -| event_type | integer | the [event type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-event-types) | -| trigger_type | integer | the [trigger type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types) | -| trigger_metadata | object | the [trigger metadata](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types) | -| actions | array | the [actions](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object) which will execute when rule is triggered | -| enabled | boolean | whether the rule is enabled | -| exempt_roles | array of snowflakes | the role ids that should not be affected by the rule (Maximum of 20) | -| exempt_channels | array of snowflakes | the channel ids that should not be affected by the rule (Maximum of 50) | +| Field | Type | Description | +| ---------------- | ------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| id | snowflake | the id of this rule | +| guild_id | snowflake | the guild which this rule belongs to | +| name | string | the rule name | +| creator_id | snowflake | the user which first created this rule | +| event_type | integer | the rule [event type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-event-types) | +| trigger_type | integer | the rule [trigger type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types) | +| trigger_metadata | object | the rule [trigger metadata](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types) | +| actions | array | the [actions](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object) which will execute when the rule is triggered | +| enabled | boolean | whether the rule is enabled | +| exempt_roles | array of snowflakes | the role ids that should not be affected by the rule (Maximum of 20) | +| exempt_channels | array of snowflakes | the channel ids that should not be affected by the rule (Maximum of 50) | ###### Example Auto Moderation Rule From 09755dd710eb592a1e95c22b4a5224bc607dca77 Mon Sep 17 00:00:00 2001 From: Hemu <1871299+hemu@users.noreply.github.com> Date: Tue, 24 May 2022 21:36:31 -0400 Subject: [PATCH 27/49] Add additional action execution gateway event fields --- docs/resources/Auto_Moderation.md | 8 ++++---- docs/topics/Gateway.md | 22 ++++++++++++++++------ 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/docs/resources/Auto_Moderation.md b/docs/resources/Auto_Moderation.md index 463ab79d7f..3e53f2e014 100644 --- a/docs/resources/Auto_Moderation.md +++ b/docs/resources/Auto_Moderation.md @@ -92,10 +92,10 @@ An action which will execute whenever a rule is triggered. ###### Action Types -| Type | Value | Description | -| ------------------ | ------- | --------------------------------------------------------------- | -| BLOCK_MESSAGE | 1 | blocks the content of a message according to the rule | -| LOG_TO_CHANNEL | 2 | records original message in a specified channel | +| Type | Value | Description | +| --------------------- | ------- | --------------------------------------------------------------- | +| BLOCK_MESSAGE | 1 | blocks the content of a message according to the rule | +| SEND_ALERT_MESSAGE | 2 | records original message in a specified channel | ### Auto Moderation Permission Requirements diff --git a/docs/topics/Gateway.md b/docs/topics/Gateway.md index e7071f399e..7a0497e2ea 100644 --- a/docs/topics/Gateway.md +++ b/docs/topics/Gateway.md @@ -868,12 +868,22 @@ Sent when an rule is triggered and an action is executed (e.g. message is blocke ###### Auto Moderation Action Execution Event Fields -| Field | Type | Description | -| ------------------- | ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------- | -| action | [auto moderation action](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object) object | the action which was executed | -| guild_id | snowflake | the id of the guild in which action was executed | - -**TODO**: Add more fields which will be exposed here after they are finalized +| Field | Type | Description | +| ----------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| guild_id | snowflake | the id of the guild in which action was executed | +| action | [auto moderation action](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object) object | the action which was executed | +| rule_id | snowflake | the id of the rule which action belongs to | +| rule_trigger_type | [trigger_type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types) | the trigger type of rule which was triggered | +| channel_id | ?snowflake | the id of the channel in which user content was posted | +| message_id | ?snowflake | the id of any user message which content belongs to * | +| alert_system_message_id | ?snowflake | the id of any system auto moderation messages posted as a result of this action ** | +| content | string | the user generated text content | +| matched_keyword | ?string | the word or phrase configured in rule that triggered rule | +| matched_content | ?string | the substring in content that triggered rule | + + +\* `message_id` will not exist if message was blocked by automod or content was not part of any message +\** `alert_system_message_id` will not exist if this event does not correspond to an action with type `SEND_ALERT_MESSAGE` ### Channels From 88b95ce1200100fa61299d44ede8352ee31d09ae Mon Sep 17 00:00:00 2001 From: Hemu <1871299+hemu@users.noreply.github.com> Date: Wed, 25 May 2022 11:04:49 -0400 Subject: [PATCH 28/49] Add metadata structures, some renaming --- docs/resources/Auto_Moderation.md | 71 +++++++++++++++++++++---------- 1 file changed, 48 insertions(+), 23 deletions(-) diff --git a/docs/resources/Auto_Moderation.md b/docs/resources/Auto_Moderation.md index 3e53f2e014..c25591443a 100644 --- a/docs/resources/Auto_Moderation.md +++ b/docs/resources/Auto_Moderation.md @@ -55,19 +55,35 @@ can be setup to automatically execute whenever a rule is triggered. Characterizes what type of information will be checked to determine whether a rule is triggered. -| Type | Value | Description | -| -------------------- | ------- | ------------------------------------------------------------------------------- | -| KEYWORDS | 1 | check if any words from a user defined list of keywords exist in content | -| HARMFUL_LINKS | 2 | check if any known harmful links exist in content | -| SPAM | 3 | check if content represents generic spam | -| DEFAULT_KEYWORD_LIST | 4 | check if any words from built in pre-determined lists of words exist in content | +| Type | Value | Description | +| -------------------- | ------- | --------------------------------------------------------------------- | +| KEYWORD | 1 | check if content contains words from a user defined list of keywords | +| HARMFUL_LINK | 2 | check if content contains any harmful links | +| SPAM | 3 | check if content represents generic spam | +| KEYWORD_PRESET | 4 | check if content contains words from internal pre-determined wordsets | ###### Trigger Metadata -Additional data needed to figure out whether a rule should be triggered. Different fields are relevant based on the +Additional data used to determine whether a rule should be triggered. Different fields are relevant based on the value of [trigger_type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types). -**TODO** +| Field | Type | Associated Trigger Types | Description | +| -------------- | --------------------------------------------------------------------------------------------------- | ----------------------------- | ------------------------------------------------------------------------- | +| keyword_filter | array of strings | KEYWORD | substrings to match in content | +| keyword_lists | array of [wordset types](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-wordset-types) | KEYWORD_PRESET | additional metadata needed during execution for this specific action type | + + +###### Wordset Types + +> warn +> These string values will most likely be changed to integer values before official API launch + +| Type | Value | Description | +| ---------------- | -------------- | ------------------------------------------------------------ | +| PROFANITY | PROFANITY | Words that may be considered forms of swearing or cursing | +| SEXUAL_CONTENT | SEXUAL_CONTENT | Words that refer to sexually explicit behavior or activity | +| SLURS | SLURS | Personal insults or words that may be considered hate speech | + ###### Event Types @@ -84,34 +100,43 @@ An action which will execute whenever a rule is triggered. ###### Auto Moderation Action Structure -| Field | Type | Description | -| ------------------------- | ----------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | -| type | [action type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object-action-types) | the type of action | -| metadata | **TODO** | additional metadata needed during execution for this specific action type | +| Field | Type | Description | +| -------- | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------- | +| type | [action type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object-action-types) | the type of action | +| metadata | [action metadata](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object-action-metadata) | additional metadata needed during execution for this specific action type | ###### Action Types -| Type | Value | Description | -| --------------------- | ------- | --------------------------------------------------------------- | -| BLOCK_MESSAGE | 1 | blocks the content of a message according to the rule | -| SEND_ALERT_MESSAGE | 2 | records original message in a specified channel | +| Type | Value | Description | +| --------------------- | ------- | ----------------------------------------------------- | +| BLOCK_MESSAGE | 1 | blocks the content of a message according to the rule | +| SEND_ALERT_MESSAGE | 2 | logs user content to a specified channel | +###### Action Metadata + +Additional data used when an action is executed. Different fields are relevant based on +value of [action type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object-action-types). + +| Field | Type | Associated Action Types | Description | +| ---------- | ---------- | ----------------------- | ---------------------------------------------- | +| channel_id | snowflake | SEND_ALERT_MESSAGE | channel to which user content should be logged | + ### Auto Moderation Permission Requirements Users are required to have the `MANAGE_GUILD` permission to access all Auto Moderation resources. ### Auto Moderation Limits Per Trigger Type -Users are required to have the `MANAGE_GUILD` permission to access all Auto Moderation resources. +Number of rules allowed per trigger type in each guild. -| Type | Max Per Guild | -| -------------------- | ------------- | -| KEYWORDS | 3 | -| HARMFUL_LINKS | 1 | -| SPAM | 1 | -| DEFAULT_KEYWORD_LIST | 1 | +| Type | Max Per Guild | +| -------------- | ------------- | +| KEYWORD | 3 | +| HARMFUL_LINK | 1 | +| SPAM | 1 | +| KEYWORD_PRESET | 1 | ## List Auto Moderation Rules for Guild % GET /guilds/{guild.id#DOCS_RESOURCES_GUILD/guild-object}/auto-moderation/rules From 04a8285a6f1038b9e53d45dc3eb0c1177c09ff1a Mon Sep 17 00:00:00 2001 From: MateoDeveloper <79017590+Mateo-tem@users.noreply.github.com> Date: Mon, 6 Jun 2022 18:36:34 -0500 Subject: [PATCH 29/49] add timeout action type Co-authored-by: Jupith <51760248+Jupith@users.noreply.github.com> --- docs/resources/Auto_Moderation.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/resources/Auto_Moderation.md b/docs/resources/Auto_Moderation.md index c25591443a..6113624ca5 100644 --- a/docs/resources/Auto_Moderation.md +++ b/docs/resources/Auto_Moderation.md @@ -112,6 +112,7 @@ An action which will execute whenever a rule is triggered. | --------------------- | ------- | ----------------------------------------------------- | | BLOCK_MESSAGE | 1 | blocks the content of a message according to the rule | | SEND_ALERT_MESSAGE | 2 | logs user content to a specified channel | +| TIMEOUT | 3 | times out user for specified duration | ###### Action Metadata From da8f977f297e32faffb1e37f4b3da975654d6f52 Mon Sep 17 00:00:00 2001 From: MateoDeveloper <79017590+Mateo-tem@users.noreply.github.com> Date: Mon, 6 Jun 2022 18:36:57 -0500 Subject: [PATCH 30/49] add timeout action metadata Co-authored-by: Jupith <51760248+Jupith@users.noreply.github.com> --- docs/resources/Auto_Moderation.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/resources/Auto_Moderation.md b/docs/resources/Auto_Moderation.md index 6113624ca5..66f886b38d 100644 --- a/docs/resources/Auto_Moderation.md +++ b/docs/resources/Auto_Moderation.md @@ -122,7 +122,11 @@ value of [action type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-ob | Field | Type | Associated Action Types | Description | | ---------- | ---------- | ----------------------- | ---------------------------------------------- | -| channel_id | snowflake | SEND_ALERT_MESSAGE | channel to which user content should be logged | +| channel_id | snowflake | SEND_ALERT_MESSAGE | channel to which user content should be logged | +| duration_seconds | snowflake | SEND_ALERT_MESSAGE | timeout duration in seconds | + +>info +>Only trigger type 1 is permitted to use `duration_seconds` in metadata ### Auto Moderation Permission Requirements From 3156017a09093ec9aecb8436d8945731aa05d5d0 Mon Sep 17 00:00:00 2001 From: Mateo Date: Mon, 6 Jun 2022 20:53:53 -0500 Subject: [PATCH 31/49] fix table formatting and some stuff related to timeout action --- docs/resources/Auto_Moderation.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/resources/Auto_Moderation.md b/docs/resources/Auto_Moderation.md index 66f886b38d..9c0c48e6b5 100644 --- a/docs/resources/Auto_Moderation.md +++ b/docs/resources/Auto_Moderation.md @@ -120,10 +120,10 @@ An action which will execute whenever a rule is triggered. Additional data used when an action is executed. Different fields are relevant based on value of [action type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object-action-types). -| Field | Type | Associated Action Types | Description | -| ---------- | ---------- | ----------------------- | ---------------------------------------------- | -| channel_id | snowflake | SEND_ALERT_MESSAGE | channel to which user content should be logged | -| duration_seconds | snowflake | SEND_ALERT_MESSAGE | timeout duration in seconds | +| Field | Type | Associated Action Types | Description | +| -------------------- | ---------- | ----------------------- | ---------------------------------------------- | +| channel_id | snowflake | SEND_ALERT_MESSAGE | channel to which user content should be logged | +| duration_seconds | integer | TIMEOUT | timeout duration in seconds | >info >Only trigger type 1 is permitted to use `duration_seconds` in metadata From 16cf44cc35a21cd6d970d6c61ae17577e15a73e0 Mon Sep 17 00:00:00 2001 From: Hemu <1871299+hemu@users.noreply.github.com> Date: Tue, 7 Jun 2022 23:04:11 -0400 Subject: [PATCH 32/49] change keyword_lists field to new presets field --- docs/resources/Auto_Moderation.md | 45 ++++++++++++++++--------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/docs/resources/Auto_Moderation.md b/docs/resources/Auto_Moderation.md index 9c0c48e6b5..d4b0b5a53f 100644 --- a/docs/resources/Auto_Moderation.md +++ b/docs/resources/Auto_Moderation.md @@ -55,34 +55,34 @@ can be setup to automatically execute whenever a rule is triggered. Characterizes what type of information will be checked to determine whether a rule is triggered. -| Type | Value | Description | -| -------------------- | ------- | --------------------------------------------------------------------- | -| KEYWORD | 1 | check if content contains words from a user defined list of keywords | -| HARMFUL_LINK | 2 | check if content contains any harmful links | -| SPAM | 3 | check if content represents generic spam | -| KEYWORD_PRESET | 4 | check if content contains words from internal pre-determined wordsets | +| Type | Value | Description | +| -------------------- | ------- | -------------------------------------------------------------------- | +| KEYWORD | 1 | check if content contains words from a user defined list of keywords | +| HARMFUL_LINK | 2 | check if content contains any harmful links | +| SPAM | 3 | check if content represents generic spam | +| KEYWORD_PRESET | 4 | check if content contains words from internal pre-defined wordsets | ###### Trigger Metadata Additional data used to determine whether a rule should be triggered. Different fields are relevant based on the value of [trigger_type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types). -| Field | Type | Associated Trigger Types | Description | -| -------------- | --------------------------------------------------------------------------------------------------- | ----------------------------- | ------------------------------------------------------------------------- | -| keyword_filter | array of strings | KEYWORD | substrings to match in content | -| keyword_lists | array of [wordset types](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-wordset-types) | KEYWORD_PRESET | additional metadata needed during execution for this specific action type | +| Field | Type | Associated Trigger Types | Description | +| -------------- | ----------------------------------------------------------------------------------------------------------------- | ------------------------ | ------------------------------------------------------------------------- | +| keyword_filter | array of strings | KEYWORD | substrings to match in content | +| presets | array of [keyword preset types](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-keyword-preset-types) | KEYWORD_PRESET | additional metadata needed during execution for this specific action type | -###### Wordset Types +###### Keyword Preset Types > warn > These string values will most likely be changed to integer values before official API launch -| Type | Value | Description | -| ---------------- | -------------- | ------------------------------------------------------------ | -| PROFANITY | PROFANITY | Words that may be considered forms of swearing or cursing | -| SEXUAL_CONTENT | SEXUAL_CONTENT | Words that refer to sexually explicit behavior or activity | -| SLURS | SLURS | Personal insults or words that may be considered hate speech | +| Type | Value | Description | +| ---------------- | ----- | ------------------------------------------------------------ | +| PROFANITY | 1 | Words that may be considered forms of swearing or cursing | +| SEXUAL_CONTENT | 2 | Words that refer to sexually explicit behavior or activity | +| SLURS | 3 | Personal insults or words that may be considered hate speech | ###### Event Types @@ -112,7 +112,7 @@ An action which will execute whenever a rule is triggered. | --------------------- | ------- | ----------------------------------------------------- | | BLOCK_MESSAGE | 1 | blocks the content of a message according to the rule | | SEND_ALERT_MESSAGE | 2 | logs user content to a specified channel | -| TIMEOUT | 3 | times out user for specified duration | +| TIMEOUT | 3 | timeout user for specified duration | ###### Action Metadata @@ -120,10 +120,13 @@ An action which will execute whenever a rule is triggered. Additional data used when an action is executed. Different fields are relevant based on value of [action type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object-action-types). -| Field | Type | Associated Action Types | Description | -| -------------------- | ---------- | ----------------------- | ---------------------------------------------- | -| channel_id | snowflake | SEND_ALERT_MESSAGE | channel to which user content should be logged | -| duration_seconds | integer | TIMEOUT | timeout duration in seconds | +| Field | Type | Associated Action Types | Description | +| ---------------- | ---------- | ----------------------- | ---------------------------------------------- | +| channel_id | snowflake | SEND_ALERT_MESSAGE | channel to which user content should be logged | +| duration_seconds | integer | TIMEOUT | timeout duration in seconds * | + +\* Maximum of 2419200 seconds (4 weeks) + >info >Only trigger type 1 is permitted to use `duration_seconds` in metadata From 824e6902f79dada556d8d535d2d526cffdd093f4 Mon Sep 17 00:00:00 2001 From: Hemu <1871299+hemu@users.noreply.github.com> Date: Tue, 7 Jun 2022 23:13:42 -0400 Subject: [PATCH 33/49] remove embed type since no guarantee for official support in future --- docs/resources/Channel.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/resources/Channel.md b/docs/resources/Channel.md index 92b94d4eb4..eaf4b78df7 100644 --- a/docs/resources/Channel.md +++ b/docs/resources/Channel.md @@ -564,7 +564,6 @@ Embed types are "loosely defined" and, for the most part, are not used by our cl | gifv | animated gif image embed rendered as a video embed | | article | article embed | | link | link embed | -| auto_moderation_message | automod alert embed | ###### Embed Thumbnail Structure From 4fdc9ebe1752c67d2281a37a3867552d4b5b93c8 Mon Sep 17 00:00:00 2001 From: Hemu <1871299+hemu@users.noreply.github.com> Date: Tue, 7 Jun 2022 23:39:17 -0400 Subject: [PATCH 34/49] add user_id to auto_moderation_action_execution gateway event --- docs/resources/Channel.md | 16 ++++++++-------- docs/topics/Gateway.md | 5 +++-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/docs/resources/Channel.md b/docs/resources/Channel.md index eaf4b78df7..8ef92e8fb9 100644 --- a/docs/resources/Channel.md +++ b/docs/resources/Channel.md @@ -556,14 +556,14 @@ A thread member is used to indicate whether a user has joined a thread or not. Embed types are "loosely defined" and, for the most part, are not used by our clients for rendering. Embed attributes power what is rendered. Embed types should be considered deprecated and might be removed in a future API version. -| Type | Description | -|----------------------------|----------------------------------------------------| -| rich | generic embed rendered from embed attributes | -| image | image embed | -| video | video embed | -| gifv | animated gif image embed rendered as a video embed | -| article | article embed | -| link | link embed | +| Type | Description | +|---------|----------------------------------------------------| +| rich | generic embed rendered from embed attributes | +| image | image embed | +| video | video embed | +| gifv | animated gif image embed rendered as a video embed | +| article | article embed | +| link | link embed | ###### Embed Thumbnail Structure diff --git a/docs/topics/Gateway.md b/docs/topics/Gateway.md index 7a0497e2ea..676483c2ef 100644 --- a/docs/topics/Gateway.md +++ b/docs/topics/Gateway.md @@ -874,12 +874,13 @@ Sent when an rule is triggered and an action is executed (e.g. message is blocke | action | [auto moderation action](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object) object | the action which was executed | | rule_id | snowflake | the id of the rule which action belongs to | | rule_trigger_type | [trigger_type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types) | the trigger type of rule which was triggered | +| user_id | snowflake | the id of the user which generated the content which triggered the rule | | channel_id | ?snowflake | the id of the channel in which user content was posted | | message_id | ?snowflake | the id of any user message which content belongs to * | | alert_system_message_id | ?snowflake | the id of any system auto moderation messages posted as a result of this action ** | | content | string | the user generated text content | -| matched_keyword | ?string | the word or phrase configured in rule that triggered rule | -| matched_content | ?string | the substring in content that triggered rule | +| matched_keyword | ?string | the word or phrase configured in the rule that triggered the rule | +| matched_content | ?string | the substring in content that triggered the rule | \* `message_id` will not exist if message was blocked by automod or content was not part of any message From 351cba309092f58f0c74acc2b5cd85a6b02ab84f Mon Sep 17 00:00:00 2001 From: Hemu <1871299+hemu@users.noreply.github.com> Date: Tue, 7 Jun 2022 23:52:48 -0400 Subject: [PATCH 35/49] remove metadata warning and fix copied description --- docs/resources/Auto_Moderation.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/docs/resources/Auto_Moderation.md b/docs/resources/Auto_Moderation.md index d4b0b5a53f..6c3ace6481 100644 --- a/docs/resources/Auto_Moderation.md +++ b/docs/resources/Auto_Moderation.md @@ -69,15 +69,12 @@ value of [trigger_type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-obj | Field | Type | Associated Trigger Types | Description | | -------------- | ----------------------------------------------------------------------------------------------------------------- | ------------------------ | ------------------------------------------------------------------------- | -| keyword_filter | array of strings | KEYWORD | substrings to match in content | -| presets | array of [keyword preset types](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-keyword-preset-types) | KEYWORD_PRESET | additional metadata needed during execution for this specific action type | +| keyword_filter | array of strings | KEYWORD | substrings which will be searched for in content | +| presets | array of [keyword preset types](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-keyword-preset-types) | KEYWORD_PRESET | the internally pre-defined wordsets which will be searched for in content | ###### Keyword Preset Types -> warn -> These string values will most likely be changed to integer values before official API launch - | Type | Value | Description | | ---------------- | ----- | ------------------------------------------------------------ | | PROFANITY | 1 | Words that may be considered forms of swearing or cursing | From a52787f3ec817a7fc894e107a0ddf77bb39d664e Mon Sep 17 00:00:00 2001 From: Hemu <1871299+hemu@users.noreply.github.com> Date: Wed, 8 Jun 2022 10:01:22 -0400 Subject: [PATCH 36/49] Update docs/resources/Auto_Moderation.md Co-authored-by: Zane Pereira --- docs/resources/Auto_Moderation.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/resources/Auto_Moderation.md b/docs/resources/Auto_Moderation.md index 6c3ace6481..644b9eb7a9 100644 --- a/docs/resources/Auto_Moderation.md +++ b/docs/resources/Auto_Moderation.md @@ -8,19 +8,19 @@ can be setup to automatically execute whenever a rule is triggered. ###### Auto Moderation Rule Structure -| Field | Type | Description | -| ---------------- | ------------------- | -------------------------------------------------------------------------------------------------------------------------- | -| id | snowflake | the id of this rule | -| guild_id | snowflake | the guild which this rule belongs to | -| name | string | the rule name | -| creator_id | snowflake | the user which first created this rule | -| event_type | integer | the rule [event type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-event-types) | -| trigger_type | integer | the rule [trigger type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types) | -| trigger_metadata | object | the rule [trigger metadata](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types) | -| actions | array | the [actions](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object) which will execute when the rule is triggered | -| enabled | boolean | whether the rule is enabled | -| exempt_roles | array of snowflakes | the role ids that should not be affected by the rule (Maximum of 20) | -| exempt_channels | array of snowflakes | the channel ids that should not be affected by the rule (Maximum of 50) | +| Field | Type | Description | +| ---------------- | ---------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------| +| id | snowflake | the id of this rule | +| guild_id | snowflake | the guild which this rule belongs to | +| name | string | the rule name | +| creator_id | snowflake | the user which first created this rule | +| event_type | integer | the rule [event type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-event-types) | +| trigger_type | integer | the rule [trigger type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types) | +| trigger_metadata | object | the rule [trigger metadata](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types) | +| actions | array of [action](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object) objects | the actions which will execute when the rule is triggered | +| enabled | boolean | whether the rule is enabled | +| exempt_roles | array of snowflakes | the role ids that should not be affected by the rule (Maximum of 20) | +| exempt_channels | array of snowflakes | the channel ids that should not be affected by the rule (Maximum of 50) | ###### Example Auto Moderation Rule From 2d5226a0b7d66b9f2516ff25d893f639fde6b9d1 Mon Sep 17 00:00:00 2001 From: Hemu <1871299+hemu@users.noreply.github.com> Date: Wed, 8 Jun 2022 10:08:14 -0400 Subject: [PATCH 37/49] consistent array type field def for endpoints --- docs/resources/Auto_Moderation.md | 38 +++++++++++++++---------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/docs/resources/Auto_Moderation.md b/docs/resources/Auto_Moderation.md index 644b9eb7a9..699c4ea390 100644 --- a/docs/resources/Auto_Moderation.md +++ b/docs/resources/Auto_Moderation.md @@ -166,16 +166,16 @@ Create a new rule. Returns an [auto moderation rule](#DOCS_RESOURCES_AUTO_MODERA ###### JSON Params -| Field | Type | Description | -| ---------------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------- | -| name | string | the name | -| event_type | integer | the [event type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-event-types) | -| trigger_type | integer | the [trigger type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types) | -| trigger_metadata | object | the [trigger metadata](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types) | -| actions | array | the [actions](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object) which will execute when rule is triggered | -| enabled? | boolean | whether the rule is enabled (False by default) | -| exempt_roles? | array of snowflakes | the role ids that should not be affected by the rule (Maximum of 20) | -| exempt_channels? | array of snowflakes | the channel ids that should not be affected by the rule (Maximum of 50) | +| Field | Type | Description | +| ---------------- | ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| name | string | the rule name | +| event_type | integer | the [event type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-event-types) | +| trigger_type | integer | the [trigger type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types) | +| trigger_metadata | object | the [trigger metadata](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types) | +| actions | array of [action](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object) objects | the actions which will execute when the rule is triggered | +| enabled? | boolean | whether the rule is enabled (False by default) | +| exempt_roles? | array of snowflakes | the role ids that should not be affected by the rule (Maximum of 20) | +| exempt_channels? | array of snowflakes | the channel ids that should not be affected by the rule (Maximum of 50) | > info > See [Auto Moderation Limits Per Trigger Type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-limits-per-trigger-type) for limits on how many rules of each trigger type can be created per guild. @@ -193,15 +193,15 @@ Modify an existing rule. Returns an [auto moderation rule](#DOCS_RESOURCES_AUTO_ ###### JSON Params -| Field | Type | Description | -| ---------------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------- | -| name | string | the name | -| event_type | integer | the [event type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-event-types) | -| trigger_metadata | object | the [trigger metadata](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types) | -| actions | array | the [actions](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object) which will execute when rule is triggered | -| enabled | boolean | whether the rule is enabled | -| exempt_roles | array of snowflakes | the role ids that should not be affected by the rule (Maximum of 20) | -| exempt_channels | array of snowflakes | the channel ids that should not be affected by the rule (Maximum of 50) | +| Field | Type | Description | +| ---------------- | ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| name | string | the rule name | +| event_type | integer | the [event type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-event-types) | +| trigger_metadata | object | the [trigger metadata](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types) | +| actions | array of [action](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object) objects | the actions which will execute when the rule is triggered | +| enabled | boolean | whether the rule is enabled | +| exempt_roles | array of snowflakes | the role ids that should not be affected by the rule (Maximum of 20) | +| exempt_channels | array of snowflakes | the channel ids that should not be affected by the rule (Maximum of 50) | ## Delete Auto Moderation Rule % DELETE /guilds/{guild.id#DOCS_RESOURCES_GUILD/guild-object}/auto-moderation/rules/{auto_moderation_rule.id#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object} From 02df621aae9538baee876bd1f44f77f509a34702 Mon Sep 17 00:00:00 2001 From: Hemu <1871299+hemu@users.noreply.github.com> Date: Wed, 8 Jun 2022 11:14:43 -0400 Subject: [PATCH 38/49] Add clarity around optional fields --- docs/resources/Auto_Moderation.md | 52 +++++++++++++++++-------------- docs/topics/Gateway.md | 26 ++++++++-------- 2 files changed, 41 insertions(+), 37 deletions(-) diff --git a/docs/resources/Auto_Moderation.md b/docs/resources/Auto_Moderation.md index 699c4ea390..94be16c0ab 100644 --- a/docs/resources/Auto_Moderation.md +++ b/docs/resources/Auto_Moderation.md @@ -97,11 +97,12 @@ An action which will execute whenever a rule is triggered. ###### Auto Moderation Action Structure -| Field | Type | Description | -| -------- | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------- | -| type | [action type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object-action-types) | the type of action | -| metadata | [action metadata](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object-action-metadata) | additional metadata needed during execution for this specific action type | +| Field | Type | Description | +| ----------- | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------- | +| type | [action type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object-action-types) | the type of action | +| metadata? * | [action metadata](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object-action-metadata) | additional metadata needed during execution for this specific action type | +\* Can be omitted based on `type`. See the `Associated Action Types` column in [action metadata](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object-action-metadata) to understand which `type` values require `metadata` to be set. ###### Action Types @@ -166,16 +167,18 @@ Create a new rule. Returns an [auto moderation rule](#DOCS_RESOURCES_AUTO_MODERA ###### JSON Params -| Field | Type | Description | -| ---------------- | ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | -| name | string | the rule name | -| event_type | integer | the [event type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-event-types) | -| trigger_type | integer | the [trigger type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types) | -| trigger_metadata | object | the [trigger metadata](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types) | -| actions | array of [action](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object) objects | the actions which will execute when the rule is triggered | -| enabled? | boolean | whether the rule is enabled (False by default) | -| exempt_roles? | array of snowflakes | the role ids that should not be affected by the rule (Maximum of 20) | -| exempt_channels? | array of snowflakes | the channel ids that should not be affected by the rule (Maximum of 50) | +| Field | Type | Description | +| ------------------- | ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| name | string | the rule name | +| event_type | integer | the [event type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-event-types) | +| trigger_type | integer | the [trigger type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types) | +| trigger_metadata? * | object | the [trigger metadata](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types) | +| actions | array of [action](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object) objects | the actions which will execute when the rule is triggered | +| enabled? | boolean | whether the rule is enabled (False by default) | +| exempt_roles? | array of snowflakes | the role ids that should not be affected by the rule (Maximum of 20) | +| exempt_channels? | array of snowflakes | the channel ids that should not be affected by the rule (Maximum of 50) | + +\* Can be omitted based on `trigger_type`. See the `Associated Trigger Types` column in [trigger metadata](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types) to understand which `trigger_type` values require `trigger_metadata` to be set. > info > See [Auto Moderation Limits Per Trigger Type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-limits-per-trigger-type) for limits on how many rules of each trigger type can be created per guild. @@ -193,16 +196,17 @@ Modify an existing rule. Returns an [auto moderation rule](#DOCS_RESOURCES_AUTO_ ###### JSON Params -| Field | Type | Description | -| ---------------- | ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | -| name | string | the rule name | -| event_type | integer | the [event type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-event-types) | -| trigger_metadata | object | the [trigger metadata](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types) | -| actions | array of [action](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object) objects | the actions which will execute when the rule is triggered | -| enabled | boolean | whether the rule is enabled | -| exempt_roles | array of snowflakes | the role ids that should not be affected by the rule (Maximum of 20) | -| exempt_channels | array of snowflakes | the channel ids that should not be affected by the rule (Maximum of 50) | - +| Field | Type | Description | +| ---------------- | ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| name | string | the rule name | +| event_type | integer | the [event type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-event-types) | +| trigger_metadata? * | object | the [trigger metadata](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types) | +| actions | array of [action](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object) objects | the actions which will execute when the rule is triggered | +| enabled | boolean | whether the rule is enabled | +| exempt_roles | array of snowflakes | the role ids that should not be affected by the rule (Maximum of 20) | +| exempt_channels | array of snowflakes | the channel ids that should not be affected by the rule (Maximum of 50) | + +\* Can be omitted based on `trigger_type`. See the `Associated Trigger Types` column in [trigger metadata](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types) to understand which `trigger_type` values require `trigger_metadata` to be set. ## Delete Auto Moderation Rule % DELETE /guilds/{guild.id#DOCS_RESOURCES_GUILD/guild-object}/auto-moderation/rules/{auto_moderation_rule.id#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object} diff --git a/docs/topics/Gateway.md b/docs/topics/Gateway.md index 676483c2ef..10b8a56c5d 100644 --- a/docs/topics/Gateway.md +++ b/docs/topics/Gateway.md @@ -868,19 +868,19 @@ Sent when an rule is triggered and an action is executed (e.g. message is blocke ###### Auto Moderation Action Execution Event Fields -| Field | Type | Description | -| ----------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | -| guild_id | snowflake | the id of the guild in which action was executed | -| action | [auto moderation action](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object) object | the action which was executed | -| rule_id | snowflake | the id of the rule which action belongs to | -| rule_trigger_type | [trigger_type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types) | the trigger type of rule which was triggered | -| user_id | snowflake | the id of the user which generated the content which triggered the rule | -| channel_id | ?snowflake | the id of the channel in which user content was posted | -| message_id | ?snowflake | the id of any user message which content belongs to * | -| alert_system_message_id | ?snowflake | the id of any system auto moderation messages posted as a result of this action ** | -| content | string | the user generated text content | -| matched_keyword | ?string | the word or phrase configured in the rule that triggered the rule | -| matched_content | ?string | the substring in content that triggered the rule | +| Field | Type | Description | +| ------------------------ | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| guild_id | snowflake | the id of the guild in which action was executed | +| action | [auto moderation action](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object) object | the action which was executed | +| rule_id | snowflake | the id of the rule which action belongs to | +| rule_trigger_type | [trigger_type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types) | the trigger type of rule which was triggered | +| user_id | snowflake | the id of the user which generated the content which triggered the rule | +| channel_id? | ?snowflake | the id of the channel in which user content was posted | +| message_id? | ?snowflake | the id of any user message which content belongs to * | +| alert_system_message_id? | ?snowflake | the id of any system auto moderation messages posted as a result of this action ** | +| content | string | the user generated text content | +| matched_keyword | ?string | the word or phrase configured in the rule that triggered the rule | +| matched_content | ?string | the substring in content that triggered the rule | \* `message_id` will not exist if message was blocked by automod or content was not part of any message From 85960364e2031f1ba2fa01bcec469ff24c10b678 Mon Sep 17 00:00:00 2001 From: Hemu <1871299+hemu@users.noreply.github.com> Date: Tue, 14 Jun 2022 10:32:44 -0400 Subject: [PATCH 39/49] add timeout permission requirement --- docs/resources/Auto_Moderation.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/resources/Auto_Moderation.md b/docs/resources/Auto_Moderation.md index 94be16c0ab..1480bbd981 100644 --- a/docs/resources/Auto_Moderation.md +++ b/docs/resources/Auto_Moderation.md @@ -110,7 +110,9 @@ An action which will execute whenever a rule is triggered. | --------------------- | ------- | ----------------------------------------------------- | | BLOCK_MESSAGE | 1 | blocks the content of a message according to the rule | | SEND_ALERT_MESSAGE | 2 | logs user content to a specified channel | -| TIMEOUT | 3 | timeout user for specified duration | +| TIMEOUT | 3 | timeout user for a specified duration * | + +\* `MODERATE_MEMBERS` permission is required to use this action type ###### Action Metadata From d54e94d5981bc05b9b67f96b71c0dcff681d2ffd Mon Sep 17 00:00:00 2001 From: Hemu <1871299+hemu@users.noreply.github.com> Date: Tue, 14 Jun 2022 10:47:10 -0400 Subject: [PATCH 40/49] add change log and further permission clarification --- docs/Change_Log.md | 10 ++++++++++ docs/resources/Auto_Moderation.md | 1 + 2 files changed, 11 insertions(+) diff --git a/docs/Change_Log.md b/docs/Change_Log.md index 7b00d027f9..e92cccfc3b 100644 --- a/docs/Change_Log.md +++ b/docs/Change_Log.md @@ -1,7 +1,17 @@ # Change Log +## Auto Moderation + +#### Jun 16, 2022 + +Add new Auto Moderation feature which enables guilds to moderate message content based on keywords, harmful links, and unwanted spam. This change includes: +- access to endpoint for creating, updating, deleting rules +- new gateway events emitted when rules are updated and when automod performs an action, with associated intents for subscribing to these events +- new audit log entries when rules are updated or automod peforms certain actions + ## Updated Command Permissions + #### Apr 27, 2022 Application command permissions have been updated to add more granular control and access to commands in Discord. You can read the major changes below, and [the updated documentation](#DOCS_INTERACTIONS_APPLICATION_COMMANDS/permissions) for details. diff --git a/docs/resources/Auto_Moderation.md b/docs/resources/Auto_Moderation.md index 1480bbd981..be166daf52 100644 --- a/docs/resources/Auto_Moderation.md +++ b/docs/resources/Auto_Moderation.md @@ -134,6 +134,7 @@ value of [action type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-ob ### Auto Moderation Permission Requirements Users are required to have the `MANAGE_GUILD` permission to access all Auto Moderation resources. +Some [action types](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object-action-types) require additional permissions, e.g. the `TIMEOUT` action type requires an additional `MODERATE_MEMBERS` permission. ### Auto Moderation Limits Per Trigger Type From 0f772099b399493dae8e91e1485e8f88857d829e Mon Sep 17 00:00:00 2001 From: MateoDeveloper <79017590+Mateo-tem@users.noreply.github.com> Date: Tue, 14 Jun 2022 19:20:55 -0500 Subject: [PATCH 41/49] add property details and links to the relevant docs Co-authored-by: Shay DeWael --- docs/Change_Log.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/Change_Log.md b/docs/Change_Log.md index e92cccfc3b..2ebb02cffd 100644 --- a/docs/Change_Log.md +++ b/docs/Change_Log.md @@ -4,14 +4,14 @@ #### Jun 16, 2022 -Add new Auto Moderation feature which enables guilds to moderate message content based on keywords, harmful links, and unwanted spam. This change includes: -- access to endpoint for creating, updating, deleting rules -- new gateway events emitted when rules are updated and when automod performs an action, with associated intents for subscribing to these events -- new audit log entries when rules are updated or automod peforms certain actions +Add new [Auto Moderation feature](#DOCS_RESOURCES_AUTO_MODERATION) which enables guilds to moderate message content based on keywords, harmful links, and unwanted spam. This change includes: +- Access new endpoint for [creating](#DOCS_RESOURCES_AUTO_MODERATION/create-auto-moderation-rule), [updating](#DOCS_RESOURCES_AUTO_MODERATION/modify-auto-moderation-rule), and [deleting](#DOCS_RESOURCES_AUTO_MODERATION/delete-auto-moderation-rule) Auto Moderation rules +- New gateway events emitted when Auto Moderation rules are [created](#DOCS_TOPICS_GATEWAY/auto-moderation-rule-create) (`AUTO_MODERATION_RULE_CREATE`), [updated](#DOCS_TOPICS_GATEWAY/auto-moderation-rule-update) (`AUTO_MODERATION_RULE_UPDATE `), and [deleted](#DOCS_TOPICS_GATEWAY/auto-moderation-rule-delete) (`AUTO_MODERATION_RULE_DELETE `). Requires the `AUTO_MODERATION_CONFIGURATION` (`1 << 20`) intent +- New gateway event emitted when a [rule is triggered](#DOCS_TOPICS_GATEWAY/auto-moderation-action-execution) (`AUTO_MODERATION_ACTION_EXECUTION`). Requires the `AUTO_MODERATION_EXECUTION` (`1 << 21`) intent +- New [audit log entries](#DOCS_RESOURCES_AUDIT_LOG/audit-log-entry-object-audit-log-events) when rules are created (`AUTO_MODERATION_RULE_CREATE`), updated (`AUTO_MODERATION_RULE_UPDATE`), or deleted (`AUTO_MODERATION_RULE_DELETE`), or when AutoMod performs an action (`AUTO_MODERATION_BLOCK_MESSAGE`( ## Updated Command Permissions - #### Apr 27, 2022 Application command permissions have been updated to add more granular control and access to commands in Discord. You can read the major changes below, and [the updated documentation](#DOCS_INTERACTIONS_APPLICATION_COMMANDS/permissions) for details. From a04eb7a8e1fc5d1f24f2e6e62e50cc57c65d1d45 Mon Sep 17 00:00:00 2001 From: Hemu <1871299+hemu@users.noreply.github.com> Date: Wed, 15 Jun 2022 10:32:58 -0400 Subject: [PATCH 42/49] clarify action execution vs rule triggered --- docs/Change_Log.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Change_Log.md b/docs/Change_Log.md index 2ebb02cffd..d805c31eed 100644 --- a/docs/Change_Log.md +++ b/docs/Change_Log.md @@ -7,7 +7,7 @@ Add new [Auto Moderation feature](#DOCS_RESOURCES_AUTO_MODERATION) which enables guilds to moderate message content based on keywords, harmful links, and unwanted spam. This change includes: - Access new endpoint for [creating](#DOCS_RESOURCES_AUTO_MODERATION/create-auto-moderation-rule), [updating](#DOCS_RESOURCES_AUTO_MODERATION/modify-auto-moderation-rule), and [deleting](#DOCS_RESOURCES_AUTO_MODERATION/delete-auto-moderation-rule) Auto Moderation rules - New gateway events emitted when Auto Moderation rules are [created](#DOCS_TOPICS_GATEWAY/auto-moderation-rule-create) (`AUTO_MODERATION_RULE_CREATE`), [updated](#DOCS_TOPICS_GATEWAY/auto-moderation-rule-update) (`AUTO_MODERATION_RULE_UPDATE `), and [deleted](#DOCS_TOPICS_GATEWAY/auto-moderation-rule-delete) (`AUTO_MODERATION_RULE_DELETE `). Requires the `AUTO_MODERATION_CONFIGURATION` (`1 << 20`) intent -- New gateway event emitted when a [rule is triggered](#DOCS_TOPICS_GATEWAY/auto-moderation-action-execution) (`AUTO_MODERATION_ACTION_EXECUTION`). Requires the `AUTO_MODERATION_EXECUTION` (`1 << 21`) intent +- New gateway event emitted when an [action is executed](#DOCS_TOPICS_GATEWAY/auto-moderation-action-execution) (`AUTO_MODERATION_ACTION_EXECUTION`). Requires the `AUTO_MODERATION_EXECUTION` (`1 << 21`) intent - New [audit log entries](#DOCS_RESOURCES_AUDIT_LOG/audit-log-entry-object-audit-log-events) when rules are created (`AUTO_MODERATION_RULE_CREATE`), updated (`AUTO_MODERATION_RULE_UPDATE`), or deleted (`AUTO_MODERATION_RULE_DELETE`), or when AutoMod performs an action (`AUTO_MODERATION_BLOCK_MESSAGE`( ## Updated Command Permissions From 3cc16e60a58c377d52afa92d402de38c654250a0 Mon Sep 17 00:00:00 2001 From: Shay DeWael Date: Wed, 15 Jun 2022 12:13:37 -0700 Subject: [PATCH 43/49] Update docs/Change_Log.md --- docs/Change_Log.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Change_Log.md b/docs/Change_Log.md index d805c31eed..de04fa07f8 100644 --- a/docs/Change_Log.md +++ b/docs/Change_Log.md @@ -8,7 +8,7 @@ Add new [Auto Moderation feature](#DOCS_RESOURCES_AUTO_MODERATION) which enables - Access new endpoint for [creating](#DOCS_RESOURCES_AUTO_MODERATION/create-auto-moderation-rule), [updating](#DOCS_RESOURCES_AUTO_MODERATION/modify-auto-moderation-rule), and [deleting](#DOCS_RESOURCES_AUTO_MODERATION/delete-auto-moderation-rule) Auto Moderation rules - New gateway events emitted when Auto Moderation rules are [created](#DOCS_TOPICS_GATEWAY/auto-moderation-rule-create) (`AUTO_MODERATION_RULE_CREATE`), [updated](#DOCS_TOPICS_GATEWAY/auto-moderation-rule-update) (`AUTO_MODERATION_RULE_UPDATE `), and [deleted](#DOCS_TOPICS_GATEWAY/auto-moderation-rule-delete) (`AUTO_MODERATION_RULE_DELETE `). Requires the `AUTO_MODERATION_CONFIGURATION` (`1 << 20`) intent - New gateway event emitted when an [action is executed](#DOCS_TOPICS_GATEWAY/auto-moderation-action-execution) (`AUTO_MODERATION_ACTION_EXECUTION`). Requires the `AUTO_MODERATION_EXECUTION` (`1 << 21`) intent -- New [audit log entries](#DOCS_RESOURCES_AUDIT_LOG/audit-log-entry-object-audit-log-events) when rules are created (`AUTO_MODERATION_RULE_CREATE`), updated (`AUTO_MODERATION_RULE_UPDATE`), or deleted (`AUTO_MODERATION_RULE_DELETE`), or when AutoMod performs an action (`AUTO_MODERATION_BLOCK_MESSAGE`( +- New [audit log entries](#DOCS_RESOURCES_AUDIT_LOG/audit-log-entry-object-audit-log-events) when rules are created (`AUTO_MODERATION_RULE_CREATE`), updated (`AUTO_MODERATION_RULE_UPDATE`), or deleted (`AUTO_MODERATION_RULE_DELETE`), or when AutoMod performs an action (`AUTO_MODERATION_BLOCK_MESSAGE`) ## Updated Command Permissions From 56887cac7007ca255bfbb2d75b0f7043f3d105ee Mon Sep 17 00:00:00 2001 From: Hemu <1871299+hemu@users.noreply.github.com> Date: Wed, 15 Jun 2022 22:40:02 -0400 Subject: [PATCH 44/49] remove nullable fields and fix trigger metadata link --- docs/resources/Auto_Moderation.md | 26 +++++++++++++------------- docs/topics/Gateway.md | 6 +++--- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/docs/resources/Auto_Moderation.md b/docs/resources/Auto_Moderation.md index be166daf52..bed002c400 100644 --- a/docs/resources/Auto_Moderation.md +++ b/docs/resources/Auto_Moderation.md @@ -8,19 +8,19 @@ can be setup to automatically execute whenever a rule is triggered. ###### Auto Moderation Rule Structure -| Field | Type | Description | -| ---------------- | ---------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------| -| id | snowflake | the id of this rule | -| guild_id | snowflake | the guild which this rule belongs to | -| name | string | the rule name | -| creator_id | snowflake | the user which first created this rule | -| event_type | integer | the rule [event type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-event-types) | -| trigger_type | integer | the rule [trigger type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types) | -| trigger_metadata | object | the rule [trigger metadata](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types) | -| actions | array of [action](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object) objects | the actions which will execute when the rule is triggered | -| enabled | boolean | whether the rule is enabled | -| exempt_roles | array of snowflakes | the role ids that should not be affected by the rule (Maximum of 20) | -| exempt_channels | array of snowflakes | the channel ids that should not be affected by the rule (Maximum of 50) | +| Field | Type | Description | +| ---------------- | ---------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | +| id | snowflake | the id of this rule | +| guild_id | snowflake | the guild which this rule belongs to | +| name | string | the rule name | +| creator_id | snowflake | the user which first created this rule | +| event_type | integer | the rule [event type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-event-types) | +| trigger_type | integer | the rule [trigger type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types) | +| trigger_metadata | object | the rule [trigger metadata](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-metadata) | +| actions | array of [action](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-object) objects | the actions which will execute when the rule is triggered | +| enabled | boolean | whether the rule is enabled | +| exempt_roles | array of snowflakes | the role ids that should not be affected by the rule (Maximum of 20) | +| exempt_channels | array of snowflakes | the channel ids that should not be affected by the rule (Maximum of 50) | ###### Example Auto Moderation Rule diff --git a/docs/topics/Gateway.md b/docs/topics/Gateway.md index 10b8a56c5d..5ebf1792f7 100644 --- a/docs/topics/Gateway.md +++ b/docs/topics/Gateway.md @@ -875,9 +875,9 @@ Sent when an rule is triggered and an action is executed (e.g. message is blocke | rule_id | snowflake | the id of the rule which action belongs to | | rule_trigger_type | [trigger_type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-trigger-types) | the trigger type of rule which was triggered | | user_id | snowflake | the id of the user which generated the content which triggered the rule | -| channel_id? | ?snowflake | the id of the channel in which user content was posted | -| message_id? | ?snowflake | the id of any user message which content belongs to * | -| alert_system_message_id? | ?snowflake | the id of any system auto moderation messages posted as a result of this action ** | +| channel_id? | snowflake | the id of the channel in which user content was posted | +| message_id? | snowflake | the id of any user message which content belongs to * | +| alert_system_message_id? | snowflake | the id of any system auto moderation messages posted as a result of this action ** | | content | string | the user generated text content | | matched_keyword | ?string | the word or phrase configured in the rule that triggered the rule | | matched_content | ?string | the substring in content that triggered the rule | From 4f20205d76bbd83efc434a77c5f5e6cd20814ee6 Mon Sep 17 00:00:00 2001 From: MateoDeveloper <79017590+Mateo-tem@users.noreply.github.com> Date: Wed, 15 Jun 2022 22:31:56 -0500 Subject: [PATCH 45/49] fix description of MESSAGE_SEND event type Co-authored-by: advaith --- docs/resources/Auto_Moderation.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/resources/Auto_Moderation.md b/docs/resources/Auto_Moderation.md index bed002c400..388b9858db 100644 --- a/docs/resources/Auto_Moderation.md +++ b/docs/resources/Auto_Moderation.md @@ -86,9 +86,9 @@ value of [trigger_type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-obj Indicates in what event context a rule should be checked. -| Type | Value | Description | -| ---------------- | ------- | ---------------------------------------- | -| MESSAGE_SEND | 1 | when a member sends a message on a guild | +| Type | Value | Description | +| ---------------- | ------- | --------------------------------------------------- | +| MESSAGE_SEND | 1 | when a member sends or edits a message in the guild | ### Auto Moderation Action Object From 21dc820ea0f8349fdfcebd5ae28758c9befe6cc4 Mon Sep 17 00:00:00 2001 From: Mateo Date: Wed, 15 Jun 2022 22:38:03 -0500 Subject: [PATCH 46/49] fix some inconsistencies --- docs/resources/Auto_Moderation.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/resources/Auto_Moderation.md b/docs/resources/Auto_Moderation.md index 388b9858db..f68eab50bd 100644 --- a/docs/resources/Auto_Moderation.md +++ b/docs/resources/Auto_Moderation.md @@ -1,8 +1,6 @@ # Auto Moderation -Auto Moderation is a per [guild](#DOCS_RESOURCES_GUILD/) feature which allows the configuration of a set of rules -to trigger based on some criteria, e.g. a message contains a specific keyword. Certain actions, such as blocking a message, -can be setup to automatically execute whenever a rule is triggered. +Auto Moderation is a per [guild](#DOCS_RESOURCES_GUILD/) feature which allows the configuration of a set of rules to trigger based on some criteria, e.g. a message contains a specific keyword. Certain actions, such as blocking a message, can be setup to automatically execute whenever a rule is triggered. ### Auto Moderation Rule Object @@ -129,7 +127,7 @@ value of [action type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-ob >info ->Only trigger type 1 is permitted to use `duration_seconds` in metadata +>Only `KEYWORD` rules can have a `TIMEOUT` action. ### Auto Moderation Permission Requirements From ad77c4ef35ef2ddcb4f15b4f201710b2faefc2bc Mon Sep 17 00:00:00 2001 From: Hemu <1871299+hemu@users.noreply.github.com> Date: Thu, 16 Jun 2022 00:00:46 -0400 Subject: [PATCH 47/49] Add keyword matching strategies --- docs/resources/Auto_Moderation.md | 55 ++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 4 deletions(-) diff --git a/docs/resources/Auto_Moderation.md b/docs/resources/Auto_Moderation.md index f68eab50bd..715893b60c 100644 --- a/docs/resources/Auto_Moderation.md +++ b/docs/resources/Auto_Moderation.md @@ -1,6 +1,8 @@ # Auto Moderation -Auto Moderation is a per [guild](#DOCS_RESOURCES_GUILD/) feature which allows the configuration of a set of rules to trigger based on some criteria, e.g. a message contains a specific keyword. Certain actions, such as blocking a message, can be setup to automatically execute whenever a rule is triggered. +Auto Moderation is a feature which allows each [guild](#DOCS_RESOURCES_GUILD/) to set up rules that trigger based on some criteria. For example, a rule can trigger whenever a message contains a specific keyword. + +Rules can be configured to automatically execute actions whenever they trigger. For example, if a user tries to send a message which contains a certain keyword, a rule can trigger and block the message before it is sent. ### Auto Moderation Rule Object @@ -41,7 +43,7 @@ Auto Moderation is a per [guild](#DOCS_RESOURCES_GUILD/) feature which allows th } ], "trigger_metadata": { - "keyword_filter": ["cat*", "*cat", "*ana*"] + "keyword_filter": ["cat*", "*dog", "*ana*", "i like javascript"] }, "enabled": true, "exempt_roles": ["323456789123456789", "423456789123456789"], @@ -51,7 +53,7 @@ Auto Moderation is a per [guild](#DOCS_RESOURCES_GUILD/) feature which allows th ###### Trigger Types -Characterizes what type of information will be checked to determine whether a rule is triggered. +Characterizes the type of content which can trigger the rule. | Type | Value | Description | | -------------------- | ------- | -------------------------------------------------------------------- | @@ -67,10 +69,14 @@ value of [trigger_type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-obj | Field | Type | Associated Trigger Types | Description | | -------------- | ----------------------------------------------------------------------------------------------------------------- | ------------------------ | ------------------------------------------------------------------------- | -| keyword_filter | array of strings | KEYWORD | substrings which will be searched for in content | +| keyword_filter | array of strings * | KEYWORD | substrings which will be searched for in content | | presets | array of [keyword preset types](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-keyword-preset-types) | KEYWORD_PRESET | the internally pre-defined wordsets which will be searched for in content | +\* A keyword can be a phrase which contains multiple words. Wildcard symbols can be used to customize how each keyword will be matched. +See [keyword matching strategies](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-rule-object-keyword-matching-strategies). + + ###### Keyword Preset Types | Type | Value | Description | @@ -89,6 +95,47 @@ Indicates in what event context a rule should be checked. | MESSAGE_SEND | 1 | when a member sends or edits a message in the guild | +###### Keyword Matching Strategies + +Use the `*` wildcard symbol at the beginning and end of a keyword to define how the keyword should be matched. All keywords are case insensitve. + +**Prefix** - word must start with the keyword + +| Keyword | Matches | +| --------- | --------------------------------------| +| cat\* | **cat**ch, **Cat**apult, **CAt**tLE | +| tra\* | **tra**in, **tra**de, **TRA**ditional | +| the mat\* | **the mat**rix | + + +**Suffix** - word must end with the keyword + +| Keyword | Matches | +| --------- | ----------------------------------- | +| \*cat | wild**cat**, copy**Cat** | +| \*tra | ex**tra**, ul**tra**, orches**TRA** | +| \*the mat | brea**the mat** | + + +**Anywhere** - keyword can appear anywhere in the content + +| Keyword | Matches | +| ----------- | --------------------------- | +| \*cat\* | lo**cat**ion, edu**Cat**ion | +| \*tra\* | abs**tra**cted, ou**tra**ge | +| \*the mat\* | brea**the mat**ter | + + +**Whole Word** - keyword is a full word or phrase and must be surrounded by whitespace at the beginning and end + +| Keyword | Matches | +| ------- | ----------- | +| cat | **cat** | +| train | **train** | +| the mat | **the mat** | + + + ### Auto Moderation Action Object An action which will execute whenever a rule is triggered. From 122804d5b085144e1a3a3b4203c0c20a62efa93c Mon Sep 17 00:00:00 2001 From: Hemu <1871299+hemu@users.noreply.github.com> Date: Thu, 16 Jun 2022 00:09:28 -0400 Subject: [PATCH 48/49] move timeout action keyword rule restriction to actions section --- docs/resources/Auto_Moderation.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/docs/resources/Auto_Moderation.md b/docs/resources/Auto_Moderation.md index 715893b60c..56617345a3 100644 --- a/docs/resources/Auto_Moderation.md +++ b/docs/resources/Auto_Moderation.md @@ -157,7 +157,7 @@ An action which will execute whenever a rule is triggered. | SEND_ALERT_MESSAGE | 2 | logs user content to a specified channel | | TIMEOUT | 3 | timeout user for a specified duration * | -\* `MODERATE_MEMBERS` permission is required to use this action type +\* A `TIMEOUT` action can only be setup for `KEYWORD` rules. `MODERATE_MEMBERS` permission is required to use the `TIMEOUT` action type. ###### Action Metadata @@ -173,9 +173,6 @@ value of [action type](#DOCS_RESOURCES_AUTO_MODERATION/auto-moderation-action-ob \* Maximum of 2419200 seconds (4 weeks) ->info ->Only `KEYWORD` rules can have a `TIMEOUT` action. - ### Auto Moderation Permission Requirements Users are required to have the `MANAGE_GUILD` permission to access all Auto Moderation resources. From dbeeeea2c3871aa1b097eea99addecdbd3abfaed Mon Sep 17 00:00:00 2001 From: Hemu <1871299+hemu@users.noreply.github.com> Date: Thu, 16 Jun 2022 00:27:39 -0400 Subject: [PATCH 49/49] Update docs/Change_Log.md Co-authored-by: Splatterxl --- docs/Change_Log.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Change_Log.md b/docs/Change_Log.md index de04fa07f8..ab8919f679 100644 --- a/docs/Change_Log.md +++ b/docs/Change_Log.md @@ -5,7 +5,7 @@ #### Jun 16, 2022 Add new [Auto Moderation feature](#DOCS_RESOURCES_AUTO_MODERATION) which enables guilds to moderate message content based on keywords, harmful links, and unwanted spam. This change includes: -- Access new endpoint for [creating](#DOCS_RESOURCES_AUTO_MODERATION/create-auto-moderation-rule), [updating](#DOCS_RESOURCES_AUTO_MODERATION/modify-auto-moderation-rule), and [deleting](#DOCS_RESOURCES_AUTO_MODERATION/delete-auto-moderation-rule) Auto Moderation rules +- New endpoints for [creating](#DOCS_RESOURCES_AUTO_MODERATION/create-auto-moderation-rule), [updating](#DOCS_RESOURCES_AUTO_MODERATION/modify-auto-moderation-rule), and [deleting](#DOCS_RESOURCES_AUTO_MODERATION/delete-auto-moderation-rule) Auto Moderation rules - New gateway events emitted when Auto Moderation rules are [created](#DOCS_TOPICS_GATEWAY/auto-moderation-rule-create) (`AUTO_MODERATION_RULE_CREATE`), [updated](#DOCS_TOPICS_GATEWAY/auto-moderation-rule-update) (`AUTO_MODERATION_RULE_UPDATE `), and [deleted](#DOCS_TOPICS_GATEWAY/auto-moderation-rule-delete) (`AUTO_MODERATION_RULE_DELETE `). Requires the `AUTO_MODERATION_CONFIGURATION` (`1 << 20`) intent - New gateway event emitted when an [action is executed](#DOCS_TOPICS_GATEWAY/auto-moderation-action-execution) (`AUTO_MODERATION_ACTION_EXECUTION`). Requires the `AUTO_MODERATION_EXECUTION` (`1 << 21`) intent - New [audit log entries](#DOCS_RESOURCES_AUDIT_LOG/audit-log-entry-object-audit-log-events) when rules are created (`AUTO_MODERATION_RULE_CREATE`), updated (`AUTO_MODERATION_RULE_UPDATE`), or deleted (`AUTO_MODERATION_RULE_DELETE`), or when AutoMod performs an action (`AUTO_MODERATION_BLOCK_MESSAGE`)