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>()({
|
2021-04-28 21:06:33 +02:00
|
|
|
configType: t.type({
|
|
|
|
manual: t.boolean,
|
|
|
|
automatic: t.boolean,
|
|
|
|
}),
|
2021-02-14 16:58:02 +02:00
|
|
|
|
2021-04-28 21:06:33 +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;
|
|
|
|
}
|
2021-04-28 21:06:33 +02:00
|
|
|
// 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({ matchResult }) {
|
|
|
|
return `User was muted`;
|
|
|
|
},
|
|
|
|
});
|