From 05def5b3f2dff76a4b708d6085e9f777bd89c96a Mon Sep 17 00:00:00 2001 From: abalabahaha Date: Wed, 1 Jun 2016 15:57:05 -0700 Subject: [PATCH] voiceSwitch, update user voiceChannel earlier --- lib/Structures/Server.js | 9 ++++++--- src/Structures/Server.js | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/Structures/Server.js b/lib/Structures/Server.js index f415b2f7e..d9c6f727f 100644 --- a/lib/Structures/Server.js +++ b/lib/Structures/Server.js @@ -223,12 +223,15 @@ var Server = (function (_Equality) { Server.prototype.eventVoiceJoin = function eventVoiceJoin(user, channel) { // removes from other speaking channels first var oldChannel = this.eventVoiceLeave(user); - if (oldChannel.id) { - this.client.emit("voiceLeave", oldChannel, user); - } channel.members.add(user); user.voiceChannel = channel; + + if (oldChannel.id) { + this.client.emit("voiceLeave", oldChannel, user); + this.client.emit("voiceSwitch", oldChannel, channel, user); + } + this.client.emit("voiceJoin", channel, user); }; diff --git a/src/Structures/Server.js b/src/Structures/Server.js index f7bbeda84..ae40068f9 100644 --- a/src/Structures/Server.js +++ b/src/Structures/Server.js @@ -188,12 +188,15 @@ export default class Server extends Equality { eventVoiceJoin(user, channel) { // removes from other speaking channels first var oldChannel = this.eventVoiceLeave(user); - if (oldChannel.id) { - this.client.emit("voiceLeave", oldChannel, user); - } channel.members.add(user); user.voiceChannel = channel; + + if (oldChannel.id) { + this.client.emit("voiceLeave", oldChannel, user); + this.client.emit("voiceSwitch", oldChannel, channel, user); + } + this.client.emit("voiceJoin", channel, user); }