mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
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:
@@ -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,
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
1
packages/discord.js/typings/index.d.ts
vendored
1
packages/discord.js/typings/index.d.ts
vendored
@@ -4543,6 +4543,7 @@ export interface AutoModerationAction {
|
||||
export interface AutoModerationActionMetadata {
|
||||
channelId: Snowflake | null;
|
||||
durationSeconds: number | null;
|
||||
customMessage: string | null;
|
||||
}
|
||||
|
||||
export interface AutoModerationTriggerMetadata {
|
||||
|
||||
Reference in New Issue
Block a user