From b6bfaa38a88974f68baad4ae28e21adff5465c93 Mon Sep 17 00:00:00 2001 From: Fleny Date: Mon, 28 Jul 2025 08:41:51 +0200 Subject: [PATCH] fix(types): Add missing trigger metadata values (#4260) * Add missing triggerMetadata * Add link for EditAutoModerationRuleOptions * Update TriggerMetadata comments * Apply suggestions from code review --------- Co-authored-by: Awesome Stickz --- packages/types/src/discord/autoModeration.ts | 16 +++--- packages/types/src/discordeno.ts | 54 ++++++++++++++++++-- 2 files changed, 57 insertions(+), 13 deletions(-) diff --git a/packages/types/src/discord/autoModeration.ts b/packages/types/src/discord/autoModeration.ts index fc0df3d05..b5ab270d8 100644 --- a/packages/types/src/discord/autoModeration.ts +++ b/packages/types/src/discord/autoModeration.ts @@ -43,12 +43,12 @@ export enum AutoModerationTriggerTypes { /** https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata */ export interface DiscordAutoModerationRuleTriggerMetadata { /** - * The keywords needed to match. + * Substrings which will be searched for in content. * * @remarks * Only present with {@link AutoModerationTriggerTypes.Keyword} and {@link AutoModerationTriggerTypes.MemberProfile}. * - * Can have up to 1000 elements in the array and each string can have up to 60 characters + * Can have up to 1000 elements in the array and each string can have up to 60 characters. */ keyword_filter?: string[] /** @@ -57,28 +57,28 @@ export interface DiscordAutoModerationRuleTriggerMetadata { * @remarks * Only present with {@link AutoModerationTriggerTypes.Keyword} and {@link AutoModerationTriggerTypes.MemberProfile}. * - * Can have up to 10 elements in the array and each string can have up to 260 characters + * Only Rust flavored regex is currently supported. Can have up to 10 elements in the array and each string can have up to 260 characters. */ regex_patterns?: string[] /** - * The pre-defined lists of words to match from. + * The Discord pre-defined wordsets which will be searched for in content. * * @remarks * Only present with {@link AutoModerationTriggerTypes.KeywordPreset}. */ presets?: DiscordAutoModerationRuleTriggerMetadataPresets[] /** - * The substrings which will exempt from triggering the preset trigger type. + * The substrings which should not trigger the rule. * * @remarks * Only present with {@link AutoModerationTriggerTypes.Keyword}, {@link AutoModerationTriggerTypes.KeywordPreset} and {@link AutoModerationTriggerTypes.MemberProfile}. * - * When used with {@link AutoModerationTriggerTypes.Keyword} and {@link AutoModerationTriggerTypes.MemberProfile} there can have up to 100 elements in the array and each string can have up to 60 characters. - * When used with {@link AutoModerationTriggerTypes.KeywordPreset} there can have up to 1000 elements in the array and each string can have up to 60 characters. + * When used with {@link AutoModerationTriggerTypes.Keyword} and {@link AutoModerationTriggerTypes.MemberProfile}, there can be up to 100 elements in the array and each string can have up to 60 characters. + * When used with {@link AutoModerationTriggerTypes.KeywordPreset}, there can be up to 1000 elements in the array and each string can have up to 60 characters. */ allow_list?: string[] /** - * Total number of mentions (role & user) allowed per message. + * Total number of unique role and user mentions allowed per message. * * @remarks * Only present with {@link AutoModerationTriggerTypes.MentionSpam}. diff --git a/packages/types/src/discordeno.ts b/packages/types/src/discordeno.ts index 766c49019..651e1fe3a 100644 --- a/packages/types/src/discordeno.ts +++ b/packages/types/src/discordeno.ts @@ -1288,6 +1288,7 @@ export interface CreateAutoModerationRuleOptions { exemptChannels?: BigString[] } +/** https://discord.com/developers/docs/resources/auto-moderation#modify-auto-moderation-rule-json-params */ export interface EditAutoModerationRuleOptions { /** The name of the rule. */ name: string @@ -1295,14 +1296,57 @@ export interface EditAutoModerationRuleOptions { eventType: AutoModerationEventTypes /** The metadata to use for the trigger. */ triggerMetadata: { - /** The keywords needed to match. Only present when TriggerType.Keyword */ + /** + * Substrings which will be searched for in content. + * + * @remarks + * Only present with {@link AutoModerationTriggerTypes.Keyword} and {@link AutoModerationTriggerTypes.MemberProfile}. + * + * Can have up to 1000 elements in the array and each string can have up to 60 characters. + */ keywordFilter?: string[] - /** The pre-defined lists of words to match from. Only present when TriggerType.KeywordPreset */ + /** + * Regular expression patterns which will be matched against content. + * + * @remarks + * Only present with {@link AutoModerationTriggerTypes.Keyword} and {@link AutoModerationTriggerTypes.MemberProfile}. + * + * Only Rust flavored regex is currently supported. Can have up to 10 elements in the array and each string can have up to 260 characters. + */ + regexPatterns?: string[] + /** + * The discord pre-defined wordsets which will be searched for in content. + * + * @remarks + * Only present with {@link AutoModerationTriggerTypes.KeywordPreset}. + */ presets?: DiscordAutoModerationRuleTriggerMetadataPresets[] - /** The substrings which will exempt from triggering the preset trigger type. Only present when TriggerType.KeywordPreset */ + /** + * The substrings which should not trigger the rule. + * + * @remarks + * Only present with {@link AutoModerationTriggerTypes.Keyword}, {@link AutoModerationTriggerTypes.KeywordPreset} and {@link AutoModerationTriggerTypes.MemberProfile}. + * + * When used with {@link AutoModerationTriggerTypes.Keyword} and {@link AutoModerationTriggerTypes.MemberProfile}, there can be up to 100 elements in the array and each string can have up to 60 characters. + * When used with {@link AutoModerationTriggerTypes.KeywordPreset}, there can be up to 1000 elements in the array and each string can have up to 60 characters. + */ allowList?: string[] - /** Total number of mentions (role & user) allowed per message (Maximum of 50) */ - mentionTotalLimit: number + /** + * Total number of unique role and user mentions allowed per message. + * + * @remarks + * Only present with {@link AutoModerationTriggerTypes.MentionSpam}. + * + * Maximum of 50 + */ + mentionTotalLimit?: number + /** + * Whether to automatically detect mention raids. + * + * @remarks + * Only present with {@link AutoModerationTriggerTypes.MentionSpam}. + */ + mentionRaidProtectionEnabled?: boolean } /** The actions that will trigger for this rule */ actions: Array<{