voice rewrite part 1

This commit is contained in:
Amish Shah
2016-10-01 22:23:00 +01:00
parent 34168eb832
commit c286c1443f
3 changed files with 183 additions and 44 deletions

View File

@@ -12,9 +12,7 @@ class VoiceServerUpdate extends AbstractHandler {
handle(packet) {
const client = this.packetManager.client;
const data = packet.d;
if (client.voice.pending.has(data.guild_id) && data.endpoint) {
client.voice._receivedVoiceServer(data.guild_id, data.token, data.endpoint);
}
client.emit('self.voiceServer', data);
}
}

View File

@@ -20,8 +20,8 @@ class VoiceStateUpdateHandler extends AbstractHandler {
// if the member left the voice channel, unset their speaking property
if (!data.channel_id) member.speaking = null;
if (client.voice.pending.has(guild.id) && member.user.id === client.user.id && data.channel_id) {
client.voice._receivedVoiceStateUpdate(data.guild_id, data.session_id);
if (member.user.id === client.user.id && data.channel_id) {
client.emit('self.voiceStateUpdate', data);
}
const newChannel = client.channels.get(data.channel_id);