3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-15 05:41:51 +00:00

Add hide_case option to automod mod actions

This commit is contained in:
Dragory 2021-05-03 18:49:52 +03:00
parent 31d7748bf4
commit 25a3350196
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
6 changed files with 14 additions and 0 deletions

View file

@ -22,10 +22,12 @@ export const BanAction = automodAction({
notifyChannel: tNullable(t.string), notifyChannel: tNullable(t.string),
deleteMessageDays: tNullable(t.number), deleteMessageDays: tNullable(t.number),
postInCaseLog: tNullable(t.boolean), postInCaseLog: tNullable(t.boolean),
hide_case: t.boolean,
}), }),
defaultConfig: { defaultConfig: {
notify: null, // Use defaults from ModActions notify: null, // Use defaults from ModActions
hide_case: false,
}, },
async apply({ pluginData, contexts, actionConfig, matchResult }) { async apply({ pluginData, contexts, actionConfig, matchResult }) {
@ -39,6 +41,7 @@ export const BanAction = automodAction({
extraNotes: matchResult.fullSummary ? [matchResult.fullSummary] : [], extraNotes: matchResult.fullSummary ? [matchResult.fullSummary] : [],
automatic: true, automatic: true,
postInCaseLogOverride: actionConfig.postInCaseLog ?? undefined, postInCaseLogOverride: actionConfig.postInCaseLog ?? undefined,
hide: actionConfig.hide_case,
}; };
const userIdsToBan = unique(contexts.map(c => c.user?.id).filter(nonNullish)); const userIdsToBan = unique(contexts.map(c => c.user?.id).filter(nonNullish));

View file

@ -12,10 +12,12 @@ export const KickAction = automodAction({
notify: tNullable(t.string), notify: tNullable(t.string),
notifyChannel: tNullable(t.string), notifyChannel: tNullable(t.string),
postInCaseLog: tNullable(t.boolean), postInCaseLog: tNullable(t.boolean),
hide_case: t.boolean,
}), }),
defaultConfig: { defaultConfig: {
notify: null, // Use defaults from ModActions notify: null, // Use defaults from ModActions
hide_case: false,
}, },
async apply({ pluginData, contexts, actionConfig, matchResult }) { async apply({ pluginData, contexts, actionConfig, matchResult }) {
@ -27,6 +29,7 @@ export const KickAction = automodAction({
extraNotes: matchResult.fullSummary ? [matchResult.fullSummary] : [], extraNotes: matchResult.fullSummary ? [matchResult.fullSummary] : [],
automatic: true, automatic: true,
postInCaseLogOverride: actionConfig.postInCaseLog ?? undefined, postInCaseLogOverride: actionConfig.postInCaseLog ?? undefined,
hide: actionConfig.hide_case,
}; };
const userIdsToKick = unique(contexts.map(c => c.user?.id).filter(nonNullish)); const userIdsToKick = unique(contexts.map(c => c.user?.id).filter(nonNullish));

View file

@ -26,10 +26,12 @@ export const MuteAction = automodAction({
remove_roles_on_mute: tNullable(t.union([t.boolean, t.array(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)])), restore_roles_on_mute: tNullable(t.union([t.boolean, t.array(t.string)])),
postInCaseLog: tNullable(t.boolean), postInCaseLog: tNullable(t.boolean),
hide_case: t.boolean,
}), }),
defaultConfig: { defaultConfig: {
notify: null, // Use defaults from ModActions notify: null, // Use defaults from ModActions
hide_case: false,
}, },
async apply({ pluginData, contexts, actionConfig, ruleName, matchResult }) { async apply({ pluginData, contexts, actionConfig, ruleName, matchResult }) {
@ -44,6 +46,7 @@ export const MuteAction = automodAction({
extraNotes: matchResult.fullSummary ? [matchResult.fullSummary] : [], extraNotes: matchResult.fullSummary ? [matchResult.fullSummary] : [],
automatic: true, automatic: true,
postInCaseLogOverride: actionConfig.postInCaseLog ?? undefined, postInCaseLogOverride: actionConfig.postInCaseLog ?? undefined,
hide: actionConfig.hide_case,
}; };
const userIdsToMute = unique(contexts.map(c => c.user?.id).filter(nonNullish)); const userIdsToMute = unique(contexts.map(c => c.user?.id).filter(nonNullish));

View file

@ -12,10 +12,12 @@ export const WarnAction = automodAction({
notify: tNullable(t.string), notify: tNullable(t.string),
notifyChannel: tNullable(t.string), notifyChannel: tNullable(t.string),
postInCaseLog: tNullable(t.boolean), postInCaseLog: tNullable(t.boolean),
hide_case: t.boolean,
}), }),
defaultConfig: { defaultConfig: {
notify: null, // Use defaults from ModActions notify: null, // Use defaults from ModActions
hide_case: false,
}, },
async apply({ pluginData, contexts, actionConfig, matchResult }) { async apply({ pluginData, contexts, actionConfig, matchResult }) {
@ -27,6 +29,7 @@ export const WarnAction = automodAction({
extraNotes: matchResult.fullSummary ? [matchResult.fullSummary] : [], extraNotes: matchResult.fullSummary ? [matchResult.fullSummary] : [],
automatic: true, automatic: true,
postInCaseLogOverride: actionConfig.postInCaseLog ?? undefined, postInCaseLogOverride: actionConfig.postInCaseLog ?? undefined,
hide: actionConfig.hide_case,
}; };
const userIdsToWarn = unique(contexts.map(c => c.user?.id).filter(nonNullish)); const userIdsToWarn = unique(contexts.map(c => c.user?.id).filter(nonNullish));

View file

@ -35,6 +35,7 @@ export async function createCase(pluginData: GuildPluginData<CasesPluginType>, a
audit_log_id: args.auditLogId, audit_log_id: args.auditLogId,
pp_id: args.ppId, pp_id: args.ppId,
pp_name: ppName, pp_name: ppName,
is_hidden: Boolean(args.hide),
}); });
if (args.reason || (args.noteDetails && args.noteDetails.length)) { if (args.reason || (args.noteDetails && args.noteDetails.length)) {

View file

@ -40,6 +40,7 @@ export type CaseArgs = {
postInCaseLogOverride?: boolean; postInCaseLogOverride?: boolean;
noteDetails?: string[]; noteDetails?: string[];
extraNotes?: string[]; extraNotes?: string[];
hide?: boolean;
}; };
export type CaseNoteArgs = { export type CaseNoteArgs = {