2020-07-21 23:11:05 +02:00
|
|
|
import { PluginOptions } from "knub";
|
2020-07-22 22:56:21 +03:00
|
|
|
import { ConfigSchema, PingableRolesPluginType } from "./types";
|
2020-07-21 23:11:05 +02:00
|
|
|
import { zeppelinPlugin } from "../ZeppelinPluginBlueprint";
|
|
|
|
import { GuildPingableRoles } from "src/data/GuildPingableRoles";
|
|
|
|
import { PingableRoleEnableCmd } from "./commands/PingableRoleEnableCmd";
|
|
|
|
import { PingableRoleDisableCmd } from "./commands/PingableRoleDisableCmd";
|
2020-07-22 22:56:21 +03:00
|
|
|
import { MessageCreateDisablePingableEvt, TypingEnablePingableEvt } from "./events/ChangePingableEvts";
|
2020-07-21 23:11:05 +02:00
|
|
|
|
|
|
|
const defaultOptions: PluginOptions<PingableRolesPluginType> = {
|
|
|
|
config: {
|
|
|
|
can_manage: false,
|
|
|
|
},
|
|
|
|
overrides: [
|
|
|
|
{
|
|
|
|
level: ">=100",
|
|
|
|
config: {
|
|
|
|
can_manage: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
|
|
|
|
export const PingableRolesPlugin = zeppelinPlugin<PingableRolesPluginType>()("pingable_roles", {
|
2020-07-30 13:08:06 +03:00
|
|
|
showInDocs: true,
|
|
|
|
info: {
|
|
|
|
prettyName: "Pingable roles",
|
|
|
|
},
|
|
|
|
|
2020-07-21 23:11:05 +02:00
|
|
|
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();
|
|
|
|
},
|
|
|
|
});
|