mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
Migrate PingableRoles to new Plugin structure
This commit is contained in:
parent
f324dfc227
commit
ed344be4b5
9 changed files with 232 additions and 0 deletions
46
backend/src/plugins/PingableRoles/PingableRolesPlugin.ts
Normal file
46
backend/src/plugins/PingableRoles/PingableRolesPlugin.ts
Normal file
|
@ -0,0 +1,46 @@
|
|||
import { PluginOptions } from "knub";
|
||||
import { PingableRolesPluginType, ConfigSchema } from "./types";
|
||||
import { zeppelinPlugin } from "../ZeppelinPluginBlueprint";
|
||||
import { GuildPingableRoles } from "src/data/GuildPingableRoles";
|
||||
import { PingableRoleEnableCmd } from "./commands/PingableRoleEnableCmd";
|
||||
import { PingableRoleDisableCmd } from "./commands/PingableRoleDisableCmd";
|
||||
import { TypingEnablePingableEvt, MessageCreateDisablePingableEvt } from "./events/ChangePingableEvts";
|
||||
|
||||
const defaultOptions: PluginOptions<PingableRolesPluginType> = {
|
||||
config: {
|
||||
can_manage: false,
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
level: ">=100",
|
||||
config: {
|
||||
can_manage: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export const PingableRolesPlugin = zeppelinPlugin<PingableRolesPluginType>()("pingable_roles", {
|
||||
configSchema: ConfigSchema,
|
||||
defaultOptions,
|
||||
|
||||
// prettier-ignore
|
||||
commands: [
|
||||
PingableRoleEnableCmd,
|
||||
PingableRoleDisableCmd,
|
||||
],
|
||||
|
||||
// prettier-ignore
|
||||
events: [
|
||||
TypingEnablePingableEvt,
|
||||
MessageCreateDisablePingableEvt,
|
||||
],
|
||||
|
||||
onLoad(pluginData) {
|
||||
const { state, guild } = pluginData;
|
||||
|
||||
state.pingableRoles = GuildPingableRoles.getGuildInstance(guild.id);
|
||||
state.cache = new Map();
|
||||
state.timeouts = new Map();
|
||||
},
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue