From add14acc20558932da5992449c6a0282af99745e Mon Sep 17 00:00:00 2001 From: Jaw0r3k Date: Thu, 13 Apr 2023 18:36:46 +0200 Subject: [PATCH] feat(AutoModeration): v13 support `customMessage` (#9173) * feat: add customMessage * chore: use main wording --- src/managers/AutoModerationRuleManager.js | 3 +++ src/structures/AutoModerationRule.js | 2 ++ typings/index.d.ts | 1 + typings/rawDataTypes.d.ts | 1 + 4 files changed, 7 insertions(+) diff --git a/src/managers/AutoModerationRuleManager.js b/src/managers/AutoModerationRuleManager.js index ff886c7c3a96..0a0aeac267f2 100644 --- a/src/managers/AutoModerationRuleManager.js +++ b/src/managers/AutoModerationRuleManager.js @@ -74,6 +74,7 @@ class AutoModerationRuleManager extends CachedManager { * @typedef {Object} AutoModerationActionMetadataOptions * @property {GuildTextChannelResolvable|ThreadChannel} [channel] The channel to which content will be logged * @property {number} [durationSeconds] The timeout duration in seconds + * @property {string} [customMessage] The custom message that is shown whenever a message is blocked */ /** @@ -131,6 +132,7 @@ class AutoModerationRuleManager extends CachedManager { metadata: { duration_seconds: action.metadata?.durationSeconds, channel_id: action.metadata?.channel && this.guild.channels.resolveId(action.metadata.channel), + custom_message: action.metadata?.customMessage, }, })), enabled, @@ -192,6 +194,7 @@ class AutoModerationRuleManager extends CachedManager { metadata: { duration_seconds: action.metadata?.durationSeconds, channel_id: action.metadata?.channel && this.guild.channels.resolveId(action.metadata.channel), + custom_message: action.metadata?.customMessage, }, })), enabled, diff --git a/src/structures/AutoModerationRule.js b/src/structures/AutoModerationRule.js index 3968a83253a3..df6a428ace8a 100644 --- a/src/structures/AutoModerationRule.js +++ b/src/structures/AutoModerationRule.js @@ -101,6 +101,7 @@ class AutoModerationRule extends Base { * @typedef {Object} AutoModerationActionMetadata * @property {?Snowflake} channelId The id of the channel to which content will be logged * @property {?number} durationSeconds The timeout duration in seconds + * @property {?string} customMessage The custom message that is shown whenever a message is blocked */ /** @@ -112,6 +113,7 @@ class AutoModerationRule extends Base { metadata: { durationSeconds: action.metadata.duration_seconds ?? null, channelId: action.metadata.channel_id ?? null, + customMessage: action.metadata.custom_message ?? null, }, })); } diff --git a/typings/index.d.ts b/typings/index.d.ts index 01b53deb742d..ab7e2a25d60f 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -4267,6 +4267,7 @@ export interface AutoModerationAction { export interface AutoModerationActionMetadata { channelId: Snowflake | null; durationSeconds: number | null; + customMessage: string | null; } export interface AutoModerationTriggerMetadata { diff --git a/typings/rawDataTypes.d.ts b/typings/rawDataTypes.d.ts index 5b7aa1757cc3..f48c30dc536e 100644 --- a/typings/rawDataTypes.d.ts +++ b/typings/rawDataTypes.d.ts @@ -247,6 +247,7 @@ export interface APIAutoModerationAction { export interface APIAutoModerationActionMetadata { channel_id?: Snowflake; duration_seconds?: number; + custom_message?: string; } export interface APIAutoModerationRule {