fix: automod reason support Closes #2334

This commit is contained in:
Skillz4Killz
2022-08-25 18:02:03 +00:00
committed by GitHub
parent b89d3ca078
commit 88c0835953
3 changed files with 8 additions and 1 deletions

View File

@@ -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;
}

View File

@@ -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<undefined>(
bot.rest,
"DELETE",
bot.constants.routes.AUTOMOD_RULE(guildId, ruleId),
{ reason },
);
}

View File

@@ -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;
}