3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-14 21:31:50 +00:00
zeppelin/backend/src/plugins/Automod/triggers/mute.ts

36 lines
848 B
TypeScript
Raw Normal View History

2021-02-14 16:58:02 +02:00
import * as t from "io-ts";
import { automodTrigger } from "../helpers";
// tslint:disable-next-line:no-empty-interface
interface MuteTriggerResultType {}
export const MuteTrigger = automodTrigger<MuteTriggerResultType>()({
configType: t.type({
manual: t.boolean,
automatic: t.boolean,
}),
2021-02-14 16:58:02 +02:00
defaultConfig: {
manual: true,
automatic: true,
},
async match({ context, triggerConfig }) {
2021-02-14 16:58:02 +02:00
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;
2021-02-14 16:58:02 +02:00
return {
extra: {},
};
},
renderMatchInformation() {
2021-02-14 16:58:02 +02:00
return `User was muted`;
},
});