feat: v13 safety alerts channel and mention raid protection

#9073 djs
This commit is contained in:
Elysia
2023-02-12 15:30:49 +07:00
parent 779fc7a5f4
commit f28ea5c031
4 changed files with 63 additions and 0 deletions
+13
View File
@@ -73,6 +73,7 @@ class AutoModerationRule extends Base {
* @property {string[]} allowList The substrings that will be exempt from triggering
* {@link AutoModerationRuleTriggerTypes.KEYWORD} and {@link AutoModerationRuleTriggerTypes.KEYWORD_PRESET}
* @property {?number} mentionTotalLimit The total number of role & user mentions allowed per message
* @property {boolean} mentionRaidProtectionEnabled Whether mention raid protection is enabled
*/
/**
@@ -85,6 +86,7 @@ class AutoModerationRule extends Base {
presets: data.trigger_metadata.presets?.map(preset => AutoModerationRuleKeywordPresetTypes[preset]) ?? [],
allowList: data.trigger_metadata.allow_list ?? [],
mentionTotalLimit: data.trigger_metadata.mention_total_limit ?? null,
mentionRaidProtectionEnabled: data.trigger_metadata.mention_raid_protection_enabled ?? false,
};
}
@@ -234,6 +236,17 @@ class AutoModerationRule extends Base {
return this.edit({ triggerMetadata: { mentionTotalLimit }, reason });
}
/**
* Sets whether to enable mention raid protection for this auto moderation rule.
* @param {boolean} mentionRaidProtectionEnabled
* Whether to enable mention raid protection for this auto moderation rule
* @param {string} [reason] The reason for changing the mention raid protection of this auto moderation rule
* @returns {Promise<AutoModerationRule>}
*/
setMentionRaidProtectionEnabled(mentionRaidProtectionEnabled, reason) {
return this.edit({ triggerMetadata: { ...this.triggerMetadata, mentionRaidProtectionEnabled }, reason });
}
/**
* Sets the actions for this auto moderation rule.
* @param {AutoModerationActionOptions[]} actions The actions of this auto moderation rule