zappyzep/backend/src/plugins/SelfGrantableRoles/SelfGrantableRolesPlugin.ts
2024-11-02 14:55:29 +02:00

30 lines
847 B
TypeScript

import { CooldownManager, guildPlugin, PluginOptions } from "knub";
import { RoleAddCmd } from "./commands/RoleAddCmd";
import { RoleHelpCmd } from "./commands/RoleHelpCmd";
import { RoleRemoveCmd } from "./commands/RoleRemoveCmd";
import { SelfGrantableRolesPluginType, zSelfGrantableRolesConfig } from "./types";
const defaultOptions: PluginOptions<SelfGrantableRolesPluginType> = {
config: {
entries: {},
mention_roles: false,
},
};
export const SelfGrantableRolesPlugin = guildPlugin<SelfGrantableRolesPluginType>()({
name: "self_grantable_roles",
configParser: (input) => zSelfGrantableRolesConfig.parse(input),
defaultOptions,
// prettier-ignore
messageCommands: [
RoleHelpCmd,
RoleRemoveCmd,
RoleAddCmd,
],
beforeLoad(pluginData) {
pluginData.state.cooldowns = new CooldownManager();
},
});