feat(AutoModeration): Support custom_message (#9171)

* feat: initial commit

* docs: fix type

* docs: this is probably a better explanation

* docs: optional

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
Jiralite
2023-02-25 14:34:48 +00:00
committed by GitHub
parent a9495bd8f0
commit c1000b86ed
4 changed files with 6 additions and 0 deletions

View File

@@ -75,6 +75,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
*/
/**
@@ -130,6 +131,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,
@@ -186,6 +188,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,

View File

@@ -96,6 +96,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
*/
/**

View File

@@ -28,6 +28,7 @@ function _transformAPIAutoModerationAction(autoModerationAction) {
metadata: {
durationSeconds: autoModerationAction.metadata.duration_seconds ?? null,
channelId: autoModerationAction.metadata.channel_id ?? null,
customMessage: autoModerationAction.metadata.custom_message ?? null,
},
};
}

View File

@@ -4543,6 +4543,7 @@ export interface AutoModerationAction {
export interface AutoModerationActionMetadata {
channelId: Snowflake | null;
durationSeconds: number | null;
customMessage: string | null;
}
export interface AutoModerationTriggerMetadata {