mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
Migrate NameHistory to new Plugin structure
This commit is contained in:
parent
b6257b9189
commit
bb3eb05ec2
6 changed files with 151 additions and 0 deletions
46
backend/src/plugins/NameHistory/NameHistoryPlugin.ts
Normal file
46
backend/src/plugins/NameHistory/NameHistoryPlugin.ts
Normal file
|
@ -0,0 +1,46 @@
|
|||
import { PluginOptions } from "knub";
|
||||
import { NameHistoryPluginType, ConfigSchema } from "./types";
|
||||
import { zeppelinPlugin } from "../ZeppelinPluginBlueprint";
|
||||
import { GuildNicknameHistory } from "src/data/GuildNicknameHistory";
|
||||
import { UsernameHistory } from "src/data/UsernameHistory";
|
||||
import { Queue } from "src/Queue";
|
||||
import { NamesCmd } from "./commands/NamesCmd";
|
||||
import { ChannelJoinEvt, MessageCreateEvt } from "./events/UpdateNameEvts";
|
||||
|
||||
const defaultOptions: PluginOptions<NameHistoryPluginType> = {
|
||||
config: {
|
||||
can_view: false,
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
level: ">=50",
|
||||
config: {
|
||||
can_view: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export const NameHistoryPlugin = zeppelinPlugin<NameHistoryPluginType>()("name_history", {
|
||||
configSchema: ConfigSchema,
|
||||
defaultOptions,
|
||||
|
||||
// prettier-ignore
|
||||
commands: [
|
||||
NamesCmd,
|
||||
],
|
||||
|
||||
// prettier-ignore
|
||||
events: [
|
||||
ChannelJoinEvt,
|
||||
MessageCreateEvt,
|
||||
],
|
||||
|
||||
onLoad(pluginData) {
|
||||
const { state, guild } = pluginData;
|
||||
|
||||
state.nicknameHistory = GuildNicknameHistory.getGuildInstance(guild.id);
|
||||
state.usernameHistory = new UsernameHistory();
|
||||
state.updateQueue = new Queue();
|
||||
},
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue