Migrated Persist to new Plugin structure
This commit is contained in:
parent
b6257b9189
commit
e1323687a7
5 changed files with 144 additions and 0 deletions
backend/src/plugins/Persist
33
backend/src/plugins/Persist/PersistPlugin.ts
Normal file
33
backend/src/plugins/Persist/PersistPlugin.ts
Normal file
|
@ -0,0 +1,33 @@
|
|||
import { PluginOptions } from "knub";
|
||||
import { zeppelinPlugin } from "../ZeppelinPluginBlueprint";
|
||||
import { PersistPluginType, ConfigSchema } from "./types";
|
||||
import { GuildPersistedData } from "src/data/GuildPersistedData";
|
||||
import { GuildLogs } from "src/data/GuildLogs";
|
||||
import { StoreDataEvt } from "./events/StoreDataEvt";
|
||||
import { LoadDataEvt } from "./events/LoadDataEvt";
|
||||
|
||||
const defaultOptions: PluginOptions<PersistPluginType> = {
|
||||
config: {
|
||||
persisted_roles: [],
|
||||
persist_nicknames: false,
|
||||
persist_voice_mutes: false,
|
||||
},
|
||||
};
|
||||
|
||||
export const PersistPlugin = zeppelinPlugin<PersistPluginType>()("persist", {
|
||||
configSchema: ConfigSchema,
|
||||
defaultOptions,
|
||||
|
||||
// prettier-ignore
|
||||
events: [
|
||||
StoreDataEvt,
|
||||
LoadDataEvt,
|
||||
],
|
||||
|
||||
onLoad(pluginData) {
|
||||
const { state, guild } = pluginData;
|
||||
|
||||
state.persistedData = GuildPersistedData.getGuildInstance(guild.id);
|
||||
state.logs = new GuildLogs(guild.id);
|
||||
},
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue