From b3d0a859f4e8cf3b6b6bbcd18c7981b520d751bd Mon Sep 17 00:00:00 2001 From: March 7th <71698422+aiko-chan-ai@users.noreply.github.com> Date: Mon, 26 Dec 2022 17:53:25 +0700 Subject: [PATCH] fix: automod --- src/managers/AutoModerationRuleManager.js | 5 ++--- src/structures/AutoModerationActionExecution.js | 2 +- src/structures/AutoModerationRule.js | 12 ++++++------ 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/managers/AutoModerationRuleManager.js b/src/managers/AutoModerationRuleManager.js index 2b37326..2090c9e 100644 --- a/src/managers/AutoModerationRuleManager.js +++ b/src/managers/AutoModerationRuleManager.js @@ -33,8 +33,7 @@ class AutoModerationRuleManager extends CachedManager { * Options used to set the trigger metadata of an auto moderation rule. * @typedef {Object} AutoModerationTriggerMetadataOptions * @property {string[]} [keywordFilter] The substrings that will be searched for in the content - * @property {string[]} [regexPatterns] The regular expression patterns - * which will be matched against the content + * @property {string[]} [regexPatterns] The regular expression patterns which will be matched against the content * Only Rust-flavored regular expressions are supported. * @property {AutoModerationRuleKeywordPresetType[]} [presets] * The internally pre-defined wordsets which will be searched for in the content @@ -109,7 +108,7 @@ class AutoModerationRuleManager extends CachedManager { allow_list: triggerMetadata.allowList, mention_total_limit: triggerMetadata.mentionTotalLimit, }, - actions: actions?.map(action => ({ + actions: actions.map(action => ({ type: typeof action.type === 'number' ? action.type : AutoModerationActionTypes[action.type], metadata: { duration_seconds: action.metadata?.durationSeconds, diff --git a/src/structures/AutoModerationActionExecution.js b/src/structures/AutoModerationActionExecution.js index 7de7e54..75fa632 100644 --- a/src/structures/AutoModerationActionExecution.js +++ b/src/structures/AutoModerationActionExecution.js @@ -58,7 +58,7 @@ class AutoModerationActionExecution { /** * The content that triggered this action. - * This property requires the {@link GatewayIntentBits.MessageContent} privileged gateway intent. + * This property requires the {@link Intents.FLAGS.MESSAGE_CONTENT} privileged gateway intent. * @type {string} */ this.content = data.content; diff --git a/src/structures/AutoModerationRule.js b/src/structures/AutoModerationRule.js index 1d88259..2c909bb 100644 --- a/src/structures/AutoModerationRule.js +++ b/src/structures/AutoModerationRule.js @@ -71,7 +71,7 @@ class AutoModerationRule extends Base { * @property {AutoModerationRuleKeywordPresetType[]} presets * The internally pre-defined wordsets which will be searched for in the content * @property {string[]} allowList The substrings that will be exempt from triggering - * {@link AutoModerationRuleTriggerTypes.Keyword} and {@link AutoModerationRuleTriggerTypes.KeywordPreset} + * {@link AutoModerationRuleTriggerTypes.KEYWORD} and {@link AutoModerationRuleTriggerTypes.KEYWORD_PRESET} * @property {?number} mentionTotalLimit The total number of role & user mentions allowed per message */ @@ -190,7 +190,7 @@ class AutoModerationRule extends Base { * @returns {Promise} */ setKeywordFilter(keywordFilter, reason) { - return this.edit({ triggerMetadata: { ...this.triggerMetadata, keywordFilter }, reason }); + return this.edit({ triggerMetadata: { keywordFilter }, reason }); } /** @@ -201,7 +201,7 @@ class AutoModerationRule extends Base { * @returns {Promise} */ setRegexPatterns(regexPatterns, reason) { - return this.edit({ triggerMetadata: { ...this.triggerMetadata, regexPatterns }, reason }); + return this.edit({ triggerMetadata: { regexPatterns }, reason }); } /** @@ -211,7 +211,7 @@ class AutoModerationRule extends Base { * @returns {Promise} */ setPresets(presets, reason) { - return this.edit({ triggerMetadata: { ...this.triggerMetadata, presets }, reason }); + return this.edit({ triggerMetadata: { presets }, reason }); } /** @@ -221,7 +221,7 @@ class AutoModerationRule extends Base { * @returns {Promise} */ setAllowList(allowList, reason) { - return this.edit({ triggerMetadata: { ...this.triggerMetadata, allowList }, reason }); + return this.edit({ triggerMetadata: { allowList }, reason }); } /** @@ -231,7 +231,7 @@ class AutoModerationRule extends Base { * @returns {Promise} */ setMentionTotalLimit(mentionTotalLimit, reason) { - return this.edit({ triggerMetadata: { ...this.triggerMetadata, mentionTotalLimit }, reason }); + return this.edit({ triggerMetadata: { mentionTotalLimit }, reason }); } /**