2020-10-01 01:43:38 +03:00
|
|
|
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
|
|
|
|
import { UsernameHistory } from "../../data/UsernameHistory";
|
|
|
|
import { Queue } from "../../Queue";
|
2020-07-16 21:41:50 +02:00
|
|
|
import { UsernameSaverPluginType } from "./types";
|
2020-07-21 17:55:25 +02:00
|
|
|
import { MessageCreateUpdateUsernameEvt, VoiceChannelJoinUpdateUsernameEvt } from "./events/UpdateUsernameEvts";
|
2020-07-30 20:10:50 +03:00
|
|
|
import * as t from "io-ts";
|
2020-07-16 21:41:50 +02:00
|
|
|
|
2021-05-23 14:35:16 +03:00
|
|
|
export const UsernameSaverPlugin = zeppelinGuildPlugin<UsernameSaverPluginType>()({
|
|
|
|
name: "username_saver",
|
2020-07-30 13:08:06 +03:00
|
|
|
showInDocs: false,
|
|
|
|
|
2020-07-30 20:10:50 +03:00
|
|
|
configSchema: t.type({}),
|
|
|
|
|
2020-07-16 21:41:50 +02:00
|
|
|
// prettier-ignore
|
|
|
|
events: [
|
2020-07-21 17:55:25 +02:00
|
|
|
MessageCreateUpdateUsernameEvt,
|
|
|
|
VoiceChannelJoinUpdateUsernameEvt,
|
2020-07-16 21:41:50 +02:00
|
|
|
],
|
|
|
|
|
2021-05-23 14:35:16 +03:00
|
|
|
afterLoad(pluginData) {
|
2020-07-16 21:41:50 +02:00
|
|
|
const { state, guild } = pluginData;
|
|
|
|
|
|
|
|
state.usernameHistory = new UsernameHistory();
|
|
|
|
state.updateQueue = new Queue();
|
|
|
|
},
|
|
|
|
});
|