More initialization order fixes (vol 2)
This commit is contained in:
parent
22316eb714
commit
72637fe1b3
27 changed files with 97 additions and 44 deletions
|
@ -64,7 +64,7 @@ export const SpamPlugin = zeppelinGuildPlugin<SpamPluginType>()({
|
|||
SpamVoiceSwitchEvt,
|
||||
],
|
||||
|
||||
afterLoad(pluginData) {
|
||||
beforeLoad(pluginData) {
|
||||
const { state, guild } = pluginData;
|
||||
|
||||
state.logs = new GuildLogs(guild.id);
|
||||
|
@ -73,16 +73,21 @@ export const SpamPlugin = zeppelinGuildPlugin<SpamPluginType>()({
|
|||
state.mutes = GuildMutes.getGuildInstance(guild.id);
|
||||
|
||||
state.recentActions = [];
|
||||
state.expiryInterval = setInterval(() => clearOldRecentActions(pluginData), 1000 * 60);
|
||||
state.lastHandledMsgIds = new Map();
|
||||
|
||||
state.spamDetectionQueue = Promise.resolve();
|
||||
},
|
||||
|
||||
afterLoad(pluginData) {
|
||||
const { state } = pluginData;
|
||||
|
||||
state.expiryInterval = setInterval(() => clearOldRecentActions(pluginData), 1000 * 60);
|
||||
state.onMessageCreateFn = msg => onMessageCreate(pluginData, msg);
|
||||
state.savedMessages.events.on("create", state.onMessageCreateFn);
|
||||
},
|
||||
|
||||
beforeUnload(pluginData) {
|
||||
pluginData.state.savedMessages.events.off("create", pluginData.state.onMessageCreateFn);
|
||||
clearInterval(pluginData.state.expiryInterval);
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue