3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-10 12:25:02 +00:00

Allow Automod to distinguish whether mod actions are manual or automatic (#179)

This commit is contained in:
Nils 2021-04-28 21:06:33 +02:00 committed by GitHub
parent 90b6f4bc86
commit 51db942d97
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 106 additions and 32 deletions

View file

@ -112,7 +112,5 @@ export const WarnCmd = modActionsCmd({
msg.channel,
`Warned **${memberToWarn.user.username}#${memberToWarn.user.discriminator}** (Case #${warnResult.case.case_number})${messageResultText}`,
);
pluginData.state.events.emit("warn", user.id, reason);
},
});

View file

@ -127,7 +127,7 @@ export async function banUserId(
banTime: banTime ? humanizeDuration(banTime) : null,
});
pluginData.state.events.emit("ban", user.id, reason);
pluginData.state.events.emit("ban", user.id, reason, banOptions.isAutomodAction);
return {
status: "success",

View file

@ -85,7 +85,7 @@ export async function kickMember(
reason,
});
pluginData.state.events.emit("kick", member.id, reason);
pluginData.state.events.emit("kick", member.id, reason, kickOptions.isAutomodAction);
return {
status: "success",

View file

@ -82,6 +82,8 @@ export async function warnMember(
reason,
});
pluginData.state.events.emit("warn", member.id, reason, warnOptions.isAutomodAction);
return {
status: "success",
case: createdCase,

View file

@ -48,9 +48,9 @@ export type TConfigSchema = t.TypeOf<typeof ConfigSchema>;
export interface ModActionsEvents {
note: (userId: string, reason?: string) => void;
warn: (userId: string, reason?: string) => void;
kick: (userId: string, reason?: string) => void;
ban: (userId: string, reason?: string) => void;
warn: (userId: string, reason?: string, isAutomodAction?: boolean) => void;
kick: (userId: string, reason?: string, isAutomodAction?: boolean) => void;
ban: (userId: string, reason?: string, isAutomodAction?: boolean) => void;
unban: (userId: string, reason?: string) => void;
// mute/unmute are in the Mutes plugin
}
@ -126,17 +126,20 @@ export interface WarnOptions {
caseArgs?: Partial<CaseArgs> | null;
contactMethods?: UserNotificationMethod[] | null;
retryPromptChannel?: TextChannel | null;
isAutomodAction?: boolean;
}
export interface KickOptions {
caseArgs?: Partial<CaseArgs>;
contactMethods?: UserNotificationMethod[];
isAutomodAction?: boolean;
}
export interface BanOptions {
caseArgs?: Partial<CaseArgs>;
contactMethods?: UserNotificationMethod[];
deleteMessageDays?: number;
isAutomodAction?: boolean;
}
export type ModActionType = "note" | "warn" | "mute" | "unmute" | "kick" | "ban" | "unban";