3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-10 04:25:01 +00:00
zeppelin/backend/src/plugins/Automod/triggers/mute.ts
2024-01-14 14:25:42 +00:00

32 lines
835 B
TypeScript

import z from "zod";
import { automodTrigger } from "../helpers";
// tslint:disable-next-line:no-empty-interface
interface MuteTriggerResultType {}
const configSchema = z.strictObject({
manual: z.boolean().default(true),
automatic: z.boolean().default(true),
});
export const MuteTrigger = automodTrigger<MuteTriggerResultType>()({
configSchema,
async match({ context, triggerConfig }) {
if (context.modAction?.type !== "mute") {
return;
}
// If automatic && automatic turned off -> return
if (context.modAction.isAutomodAction && !triggerConfig.automatic) return;
// If manual && manual turned off -> return
if (!context.modAction.isAutomodAction && !triggerConfig.manual) return;
return {
extra: {},
};
},
renderMatchInformation() {
return `User was muted`;
},
});