From ed4967751c8cd16b37703b7b821ad3ad245eba90 Mon Sep 17 00:00:00 2001 From: Fleny Date: Wed, 7 Jan 2026 21:08:03 +0100 Subject: [PATCH] fix(bot): Add missing AutoModerationRuleTriggerMetadata.mentionRaidProtectionEnabled (#4611) Also copy the comments from the Discord-prefixed type --- packages/bot/src/transformers/automodRule.ts | 1 + packages/bot/src/transformers/types.ts | 48 +++++++++++++++++++- 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/packages/bot/src/transformers/automodRule.ts b/packages/bot/src/transformers/automodRule.ts index 5c295338b..a4ec14671 100644 --- a/packages/bot/src/transformers/automodRule.ts +++ b/packages/bot/src/transformers/automodRule.ts @@ -20,6 +20,7 @@ export function transformAutoModerationRule(bot: Bot, payload: DiscordAutoModera presets: payload.trigger_metadata.presets, allowList: payload.trigger_metadata.allow_list, mentionTotalLimit: payload.trigger_metadata.mention_total_limit, + mentionRaidProtectionEnabled: payload.trigger_metadata.mention_raid_protection_enabled, } : undefined, actions: payload.actions.map((action) => ({ diff --git a/packages/bot/src/transformers/types.ts b/packages/bot/src/transformers/types.ts index 165fa4b26..d6796b782 100644 --- a/packages/bot/src/transformers/types.ts +++ b/packages/bot/src/transformers/types.ts @@ -358,11 +358,57 @@ export interface AutoModerationRule { } export interface AutoModerationRuleTriggerMetadata { + /** + * 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[] + /** + * 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 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 unique role and user mentions allowed per message. + * + * @remarks + * Only present with {@link AutoModerationTriggerTypes.MentionSpam}. + * + * Maximum of 50 + */ mentionTotalLimit?: number - regexPatterns: string[] + /** + * Whether to automatically detect mention raids. + * + * @remarks + * Only present with {@link AutoModerationTriggerTypes.MentionSpam}. + */ + mentionRaidProtectionEnabled?: boolean } export interface AvatarDecorationData {