From 88c08359539a0defe06aebb7883b2f7710f7b4fa Mon Sep 17 00:00:00 2001 From: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com> Date: Thu, 25 Aug 2022 18:02:03 +0000 Subject: [PATCH] fix: automod reason support Closes #2334 --- helpers/guilds/automod/createAutomodRule.ts | 3 +++ helpers/guilds/automod/deleteAutomodRule.ts | 3 ++- helpers/guilds/automod/editAutomodRule.ts | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/helpers/guilds/automod/createAutomodRule.ts b/helpers/guilds/automod/createAutomodRule.ts index 3fbbe99f9..5bd2b7d09 100644 --- a/helpers/guilds/automod/createAutomodRule.ts +++ b/helpers/guilds/automod/createAutomodRule.ts @@ -34,6 +34,7 @@ export async function createAutomodRule(bot: Bot, guildId: bigint, options: Crea enabled: options.enabled ?? true, exempt_roles: options.exemptRoles?.map((id) => id.toString()), exempt_channels: options.exemptChannels?.map((id) => id.toString()), + reason: options.reason, }, ); @@ -74,4 +75,6 @@ export interface CreateAutoModerationRuleOptions { exemptRoles?: bigint[]; /** The channel ids that should not be effected by the rule. */ exemptChannels?: bigint[]; + /** The reason to add to the audit logs. */ + reason?: string; } diff --git a/helpers/guilds/automod/deleteAutomodRule.ts b/helpers/guilds/automod/deleteAutomodRule.ts index a69fd6a24..6eb676eef 100644 --- a/helpers/guilds/automod/deleteAutomodRule.ts +++ b/helpers/guilds/automod/deleteAutomodRule.ts @@ -1,10 +1,11 @@ import { Bot } from "../../../bot.ts"; /** Delete a rule currently configured for guild. */ -export async function deleteAutomodRule(bot: Bot, guildId: bigint, ruleId: bigint) { +export async function deleteAutomodRule(bot: Bot, guildId: bigint, ruleId: bigint, reason?: string) { await bot.rest.runMethod( bot.rest, "DELETE", bot.constants.routes.AUTOMOD_RULE(guildId, ruleId), + { reason }, ); } diff --git a/helpers/guilds/automod/editAutomodRule.ts b/helpers/guilds/automod/editAutomodRule.ts index 19f0c588d..c94634579 100644 --- a/helpers/guilds/automod/editAutomodRule.ts +++ b/helpers/guilds/automod/editAutomodRule.ts @@ -32,6 +32,7 @@ export async function editAutomodRule(bot: Bot, guildId: bigint, options: Partia enabled: options.enabled ?? true, exempt_roles: options.exemptRoles?.map((id) => id.toString()), exempt_channels: options.exemptChannels?.map((id) => id.toString()), + reason: options.reason, }, ); @@ -71,4 +72,6 @@ export interface EditAutoModerationRuleOptions { exemptRoles?: bigint[]; /** The channel ids that should not be effected by the rule. */ exemptChannels?: bigint[]; + /** The reason to add to the audit logs. */ + reason?: string; }