mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 20:35:02 +00:00
Add antiraid commands
This commit is contained in:
parent
ed757dcbe2
commit
6324b9654b
4 changed files with 62 additions and 0 deletions
25
backend/src/plugins/Automod/commands/SetAntiraidCmd.ts
Normal file
25
backend/src/plugins/Automod/commands/SetAntiraidCmd.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import { command } from "knub";
|
||||
import { AutomodPluginType } from "../types";
|
||||
import { setAntiraidLevel } from "../functions/setAntiraidLevel";
|
||||
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
|
||||
export const SetAntiraidCmd = command<AutomodPluginType>()({
|
||||
trigger: "antiraid",
|
||||
permission: "can_set_antiraid",
|
||||
|
||||
signature: {
|
||||
level: ct.string(),
|
||||
},
|
||||
|
||||
async run({ pluginData, message, args }) {
|
||||
const config = pluginData.config.get();
|
||||
if (!config.antiraid_levels.includes(args.level)) {
|
||||
sendErrorMessage(pluginData, message.channel, "Unknown anti-raid level");
|
||||
return;
|
||||
}
|
||||
|
||||
await setAntiraidLevel(pluginData, args.level, message.author);
|
||||
sendSuccessMessage(pluginData, message.channel, `Anti-raid level set to **${args.level}**`);
|
||||
},
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue