mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
automod: add antiraid_level trigger
This commit is contained in:
parent
13294ad351
commit
b28186aa0a
5 changed files with 114 additions and 0 deletions
32
backend/src/plugins/Automod/triggers/antiraidLevel.ts
Normal file
32
backend/src/plugins/Automod/triggers/antiraidLevel.ts
Normal file
|
@ -0,0 +1,32 @@
|
|||
import * as t from "io-ts";
|
||||
import { automodTrigger } from "../helpers";
|
||||
import { tNullable } from "../../../utils";
|
||||
|
||||
// tslint:disable-next-line
|
||||
interface AntiraidLevelTriggerResult {}
|
||||
|
||||
export const AntiraidLevelTrigger = automodTrigger<AntiraidLevelTriggerResult>()({
|
||||
configType: t.type({
|
||||
level: tNullable(t.string),
|
||||
}),
|
||||
|
||||
defaultConfig: {},
|
||||
|
||||
async match({ triggerConfig, context, pluginData }) {
|
||||
if (!context.antiraid) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (context.antiraid.level !== triggerConfig.level) {
|
||||
return;
|
||||
}
|
||||
|
||||
return {
|
||||
extra: {},
|
||||
};
|
||||
},
|
||||
|
||||
renderMatchInformation({ matchResult, pluginData, contexts, triggerConfig }) {
|
||||
return `Antiraid level was set to ...`;
|
||||
},
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue