mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-15 06:05:03 +00:00
Migrate MessageSaver to new Plugin structure
This commit is contained in:
parent
b6257b9189
commit
f83d7122b9
7 changed files with 221 additions and 0 deletions
47
backend/src/plugins/MessageSaver/MessageSaverPlugin.ts
Normal file
47
backend/src/plugins/MessageSaver/MessageSaverPlugin.ts
Normal file
|
@ -0,0 +1,47 @@
|
|||
import { zeppelinPlugin } from "../ZeppelinPluginBlueprint";
|
||||
import { ConfigSchema, MessageSaverPluginType } from "./types";
|
||||
import { GuildSavedMessages } from "../../data/GuildSavedMessages";
|
||||
import { PluginOptions } from "knub";
|
||||
import { MessageCreateEvt, MessageUpdateEvt, MessageDeleteEvt, MessageDeleteBulkEvt } from "./events/SaveMessagesEvts";
|
||||
import { SaveMessagesToDBCmd } from "./commands/SaveMessagesToDB";
|
||||
import { SavePinsToDBCmd } from "./commands/SavePinsToDB";
|
||||
|
||||
const defaultOptions: PluginOptions<MessageSaverPluginType> = {
|
||||
config: {
|
||||
can_manage: false,
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
level: ">=100",
|
||||
config: {
|
||||
can_manage: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export const MessageSaverPlugin = zeppelinPlugin<MessageSaverPluginType>()("message_saver", {
|
||||
configSchema: ConfigSchema,
|
||||
defaultOptions,
|
||||
|
||||
showInDocs: false,
|
||||
|
||||
// prettier-ignore
|
||||
commands: [
|
||||
SaveMessagesToDBCmd,
|
||||
SavePinsToDBCmd,
|
||||
],
|
||||
|
||||
// prettier-ignore
|
||||
events: [
|
||||
MessageCreateEvt,
|
||||
MessageUpdateEvt,
|
||||
MessageDeleteEvt,
|
||||
MessageDeleteBulkEvt,
|
||||
],
|
||||
|
||||
onLoad(pluginData) {
|
||||
const { state, guild } = pluginData;
|
||||
state.savedMessages = GuildSavedMessages.getGuildInstance(guild.id);
|
||||
},
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue