event handler now works
This commit is contained in:
parent
728e420802
commit
d372525e35
1 changed files with 8 additions and 8 deletions
|
@ -8,56 +8,56 @@ class EventHandler {
|
||||||
handle (wsEvent, param_1, param_2) {
|
handle (wsEvent, param_1, param_2) {
|
||||||
switch (wsEvent) {
|
switch (wsEvent) {
|
||||||
case 'ready': {
|
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));
|
readyModules.forEach(module => module.run(this.client));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// param_1 - error message
|
// param_1 - error message
|
||||||
case 'error': {
|
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));
|
errorModules.forEach(module => module.run(this.client, param_1));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// param_1 - message object
|
// param_1 - message object
|
||||||
case 'messageCreate': {
|
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));
|
mCreateModules.forEach(module => module.run(this.client, param_1));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// param_1 - guild object
|
// param_1 - guild object
|
||||||
case 'guildCreate': {
|
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));
|
gCreateModules.forEach(module => module.run(this.client, param_1));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// param_1 - guild object
|
// param_1 - guild object
|
||||||
case 'guildDelete': {
|
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));
|
gDeleteModules.forEach(module => module.run(this.client, param_1));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// param_1 - guild object | param_2 - member object
|
// param_1 - guild object | param_2 - member object
|
||||||
case 'guildMemberAdd': {
|
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));
|
gMemberAddModules.forEach(module => module.run(this.client, param_1, param_2));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// param_1 - guild object | param_2 - member object
|
// param_1 - guild object | param_2 - member object
|
||||||
case 'guildMemberRemove': {
|
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));
|
gMemberRemoveModules.forEach(module => module.run(this.client, param_1, param_2));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// param_1 - old voice state | param_2 - new voice state
|
// param_1 - old voice state | param_2 - new voice state
|
||||||
case 'voiceStateUpdate': {
|
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));
|
vStateUpdateModules.forEach(module => module.run(this.client));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue