From d372525e357f7bb027000761d23cb82d468aebab Mon Sep 17 00:00:00 2001 From: mudkipscience Date: Tue, 20 Oct 2020 23:34:38 +1100 Subject: [PATCH] event handler now works --- bot/util/handlers/eventHandler.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bot/util/handlers/eventHandler.js b/bot/util/handlers/eventHandler.js index a943203..73becbc 100644 --- a/bot/util/handlers/eventHandler.js +++ b/bot/util/handlers/eventHandler.js @@ -8,56 +8,56 @@ class EventHandler { handle (wsEvent, param_1, param_2) { switch (wsEvent) { case 'ready': { - const readyModules = this.client.eventModules.filter(module => module.wsEvent === 'ready'); + const readyModules = this.client.eventModules.filter(module => module.wsEvent[0] === 'ready'); readyModules.forEach(module => module.run(this.client)); break; } // param_1 - error message case 'error': { - const errorModules = this.client.eventModules.filter(module => module.wsEvent === 'error'); + const errorModules = this.client.eventModules.filter(module => module.wsEvent[0] === 'error'); errorModules.forEach(module => module.run(this.client, param_1)); break; } // param_1 - message object case 'messageCreate': { - const mCreateModules = this.client.eventModules.filter(module => module.wsEvent === 'messageCreate'); + const mCreateModules = this.client.eventModules.filter(module => module.wsEvent[0] === 'messageCreate'); mCreateModules.forEach(module => module.run(this.client, param_1)); break; } // param_1 - guild object case 'guildCreate': { - const gCreateModules = this.client.eventModules.filter(module => module.wsEvent === 'guildCreate'); + const gCreateModules = this.client.eventModules.filter(module => module.wsEvent[0] === 'guildCreate'); gCreateModules.forEach(module => module.run(this.client, param_1)); break; } // param_1 - guild object case 'guildDelete': { - const gDeleteModules = this.client.eventModules.filter(module => module.wsEvent === 'guildDelete'); + const gDeleteModules = this.client.eventModules.filter(module => module.wsEvent[0] === 'guildDelete'); gDeleteModules.forEach(module => module.run(this.client, param_1)); break; } // param_1 - guild object | param_2 - member object case 'guildMemberAdd': { - const gMemberAddModules = this.client.eventModules.filter(module => module.wsEvent === 'guildMemberAdd'); + const gMemberAddModules = this.client.eventModules.filter(module => module.wsEvent[0] === 'guildMemberAdd'); gMemberAddModules.forEach(module => module.run(this.client, param_1, param_2)); break; } // param_1 - guild object | param_2 - member object case 'guildMemberRemove': { - const gMemberRemoveModules = this.client.eventModules.filter(module => module.wsEvent === 'guildMemberRemove'); + const gMemberRemoveModules = this.client.eventModules.filter(module => module.wsEvent[0] === 'guildMemberRemove'); gMemberRemoveModules.forEach(module => module.run(this.client, param_1, param_2)); break; } // param_1 - old voice state | param_2 - new voice state case 'voiceStateUpdate': { - const vStateUpdateModules = this.client.eventModules.filter(module => module.wsEvent === 'voiceStateUpdate'); + const vStateUpdateModules = this.client.eventModules.filter(module => module.wsEvent[0] === 'voiceStateUpdate'); vStateUpdateModules.forEach(module => module.run(this.client)); break; }