Skip to content

Commit

Permalink
feat(AutoModeration): v13 support customMessage (#9173)
Browse files Browse the repository at this point in the history
* feat: add customMessage

* chore: use main wording
  • Loading branch information
jaw0r3k committed Apr 13, 2023
1 parent 5acecf0 commit add14ac
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/managers/AutoModerationRuleManager.js
Expand Up @@ -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
*/

/**
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions src/structures/AutoModerationRule.js
Expand Up @@ -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
*/

/**
Expand All @@ -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,
},
}));
}
Expand Down
1 change: 1 addition & 0 deletions typings/index.d.ts
Expand Up @@ -4267,6 +4267,7 @@ export interface AutoModerationAction {
export interface AutoModerationActionMetadata {
channelId: Snowflake | null;
durationSeconds: number | null;
customMessage: string | null;
}

export interface AutoModerationTriggerMetadata {
Expand Down
1 change: 1 addition & 0 deletions typings/rawDataTypes.d.ts
Expand Up @@ -247,6 +247,7 @@ export interface APIAutoModerationAction {
export interface APIAutoModerationActionMetadata {
channel_id?: Snowflake;
duration_seconds?: number;
custom_message?: string;
}

export interface APIAutoModerationRule {
Expand Down

0 comments on commit add14ac

Please sign in to comment.