diff --git a/backend/src/plugins/Automod/actions/ban.ts b/backend/src/plugins/Automod/actions/ban.ts index 99b6c25b..528beed8 100644 --- a/backend/src/plugins/Automod/actions/ban.ts +++ b/backend/src/plugins/Automod/actions/ban.ts @@ -12,6 +12,7 @@ export const BanAction = automodAction({ notify: tNullable(t.string), notifyChannel: tNullable(t.string), deleteMessageDays: tNullable(t.number), + postInCaseLog: tNullable(t.boolean), }), defaultConfig: { @@ -27,6 +28,7 @@ export const BanAction = automodAction({ modId: pluginData.client.user.id, extraNotes: matchResult.fullSummary ? [matchResult.fullSummary] : [], automatic: true, + postInCaseLogOverride: actionConfig.postInCaseLog ?? undefined, }; const userIdsToBan = unique(contexts.map(c => c.user?.id).filter(nonNullish)); diff --git a/backend/src/plugins/Automod/actions/kick.ts b/backend/src/plugins/Automod/actions/kick.ts index c25684f4..7c9e6971 100644 --- a/backend/src/plugins/Automod/actions/kick.ts +++ b/backend/src/plugins/Automod/actions/kick.ts @@ -11,6 +11,7 @@ export const KickAction = automodAction({ reason: tNullable(t.string), notify: tNullable(t.string), notifyChannel: tNullable(t.string), + postInCaseLog: tNullable(t.boolean), }), defaultConfig: { @@ -25,6 +26,7 @@ export const KickAction = automodAction({ modId: pluginData.client.user.id, extraNotes: matchResult.fullSummary ? [matchResult.fullSummary] : [], automatic: true, + postInCaseLogOverride: actionConfig.postInCaseLog ?? undefined, }; const userIdsToKick = unique(contexts.map(c => c.user?.id).filter(nonNullish)); diff --git a/backend/src/plugins/Automod/actions/mute.ts b/backend/src/plugins/Automod/actions/mute.ts index ad964f44..beb13081 100644 --- a/backend/src/plugins/Automod/actions/mute.ts +++ b/backend/src/plugins/Automod/actions/mute.ts @@ -25,6 +25,7 @@ export const MuteAction = automodAction({ notifyChannel: tNullable(t.string), remove_roles_on_mute: tNullable(t.union([t.boolean, t.array(t.string)])), restore_roles_on_mute: tNullable(t.union([t.boolean, t.array(t.string)])), + postInCaseLog: tNullable(t.boolean), }), defaultConfig: { @@ -42,6 +43,7 @@ export const MuteAction = automodAction({ modId: pluginData.client.user.id, extraNotes: matchResult.fullSummary ? [matchResult.fullSummary] : [], automatic: true, + postInCaseLogOverride: actionConfig.postInCaseLog ?? undefined, }; const userIdsToMute = unique(contexts.map(c => c.user?.id).filter(nonNullish)); diff --git a/backend/src/plugins/Automod/actions/warn.ts b/backend/src/plugins/Automod/actions/warn.ts index c705b77c..f1b030b9 100644 --- a/backend/src/plugins/Automod/actions/warn.ts +++ b/backend/src/plugins/Automod/actions/warn.ts @@ -11,6 +11,7 @@ export const WarnAction = automodAction({ reason: tNullable(t.string), notify: tNullable(t.string), notifyChannel: tNullable(t.string), + postInCaseLog: tNullable(t.boolean), }), defaultConfig: { @@ -25,6 +26,7 @@ export const WarnAction = automodAction({ modId: pluginData.client.user.id, extraNotes: matchResult.fullSummary ? [matchResult.fullSummary] : [], automatic: true, + postInCaseLogOverride: actionConfig.postInCaseLog ?? undefined, }; const userIdsToWarn = unique(contexts.map(c => c.user?.id).filter(nonNullish)); diff --git a/backend/src/plugins/Cases/functions/createCase.ts b/backend/src/plugins/Cases/functions/createCase.ts index a8f58ba6..0de3d3b5 100644 --- a/backend/src/plugins/Cases/functions/createCase.ts +++ b/backend/src/plugins/Cases/functions/createCase.ts @@ -62,11 +62,11 @@ export async function createCase(pluginData: GuildPluginData, a const config = pluginData.config.get(); - if ( - config.case_log_channel && - (!args.automatic || config.log_automatic_actions) && - args.postInCaseLogOverride !== false - ) { + const shouldPostToCaseLogChannel = + args.postInCaseLogOverride === true || + ((!args.automatic || config.log_automatic_actions) && args.postInCaseLogOverride !== false); + + if (config.case_log_channel && shouldPostToCaseLogChannel) { await postCaseToCaseLogChannel(pluginData, createdCase); } diff --git a/backend/src/plugins/Cases/functions/createCaseNote.ts b/backend/src/plugins/Cases/functions/createCaseNote.ts index 34db8758..a0a6b132 100644 --- a/backend/src/plugins/Cases/functions/createCaseNote.ts +++ b/backend/src/plugins/Cases/functions/createCaseNote.ts @@ -47,7 +47,10 @@ export async function createCaseNote(pluginData: GuildPluginData