mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
Migrate AutoReactions to new Plugin structure
This commit is contained in:
parent
b6257b9189
commit
2c4e683630
6 changed files with 183 additions and 0 deletions
45
backend/src/plugins/AutoReactions/AutoReactionsPlugin.ts
Normal file
45
backend/src/plugins/AutoReactions/AutoReactionsPlugin.ts
Normal file
|
@ -0,0 +1,45 @@
|
|||
import { zeppelinPlugin } from "../ZeppelinPluginBlueprint";
|
||||
import { ConfigSchema, AutoReactionsPluginType } from "./types";
|
||||
import { PluginOptions } from "knub";
|
||||
import { NewAutoReactionsCmd } from "./commands/NewAutoReactionsCmd";
|
||||
import { DisableAutoReactionsCmd } from "./commands/DisableAutoReactionsCmd";
|
||||
import { MessageCreateEvt } from "./events/MessageCreateEvt";
|
||||
import { GuildSavedMessages } from "src/data/GuildSavedMessages";
|
||||
import { GuildAutoReactions } from "src/data/GuildAutoReactions";
|
||||
|
||||
const defaultOptions: PluginOptions<AutoReactionsPluginType> = {
|
||||
config: {
|
||||
can_manage: false,
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
level: ">=100",
|
||||
config: {
|
||||
can_manage: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export const AutoReactionsPlugin = zeppelinPlugin<AutoReactionsPluginType>()("auto_reactions", {
|
||||
configSchema: ConfigSchema,
|
||||
defaultOptions,
|
||||
|
||||
// prettier-ignore
|
||||
commands: [
|
||||
NewAutoReactionsCmd,
|
||||
DisableAutoReactionsCmd,
|
||||
],
|
||||
|
||||
// prettier-ignore
|
||||
events: [
|
||||
MessageCreateEvt,
|
||||
],
|
||||
|
||||
onLoad(pluginData) {
|
||||
const { state, guild } = pluginData;
|
||||
|
||||
state.savedMessages = GuildSavedMessages.getGuildInstance(guild.id);
|
||||
state.autoReactions = GuildAutoReactions.getGuildInstance(guild.id);
|
||||
},
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue