mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-03 09:20:08 +00:00
fix: automod reason support Closes #2334
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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 },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user