3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-07-07 19:17:19 +00:00
zeppelin/backend/src/plugins/Automod/commands/SetAntiraidCmd.ts
Dragory 45e3fe2ef0
chore: esm imports
This will make merging this into 'next' much easier.
2024-08-11 21:58:52 +03:00

24 lines
848 B
TypeScript

import { guildPluginMessageCommand } from "knub";
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { setAntiraidLevel } from "../functions/setAntiraidLevel.js";
import { AutomodPluginType } from "../types.js";
export const SetAntiraidCmd = guildPluginMessageCommand<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)) {
pluginData.state.common.sendErrorMessage(message, "Unknown anti-raid level");
return;
}
await setAntiraidLevel(pluginData, args.level, message.author);
pluginData.state.common.sendSuccessMessage(message, `Anti-raid level set to **${args.level}**`);
},
});