From db1435910d6b0426eac4585d3f51eb28227d6418 Mon Sep 17 00:00:00 2001 From: Nicholas Tay Date: Mon, 11 Apr 2016 00:38:38 +1000 Subject: [PATCH 1/2] Fix for when other users move from different server to another across voice --- lib/Client/InternalClient.js | 6 ++++-- src/Client/InternalClient.js | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/Client/InternalClient.js b/lib/Client/InternalClient.js index 0788374c3..a2e10c6b0 100644 --- a/lib/Client/InternalClient.js +++ b/lib/Client/InternalClient.js @@ -2083,9 +2083,11 @@ var InternalClient = (function () { client.emit("warn", "voice state update but user or server not in cache"); } - if (connection) { + if (user.id === self.user.id) { + // only for detecting self user movements for connections. + var connection = self.voiceConnections.get("server", server); // existing connection, perhaps channel moved - if (connection.voiceChannel.id !== data.channel_id) { + if (connection && connection.voiceChannel.id !== data.channel_id) { // moved, update info connection.voiceChannel = self.channels.get("id", data.channel_id); client.emit("voiceMoved", connection.voiceChannel); // Moved to a new channel diff --git a/src/Client/InternalClient.js b/src/Client/InternalClient.js index 2eaaa44ab..931b49927 100644 --- a/src/Client/InternalClient.js +++ b/src/Client/InternalClient.js @@ -1771,9 +1771,10 @@ export default class InternalClient { client.emit("warn", "voice state update but user or server not in cache"); } - if (connection) { + if (user.id === self.user.id) { // only for detecting self user movements for connections. + var connection = self.voiceConnections.get("server", server); // existing connection, perhaps channel moved - if (connection.voiceChannel.id !== data.channel_id) { + if (connection && connection.voiceChannel.id !== data.channel_id) { // moved, update info connection.voiceChannel = self.channels.get("id", data.channel_id); client.emit("voiceMoved", connection.voiceChannel); // Moved to a new channel From c247a3979bcdb7f12241848dcd82824a8f182d6c Mon Sep 17 00:00:00 2001 From: Nicholas Tay Date: Mon, 11 Apr 2016 00:39:14 +1000 Subject: [PATCH 2/2] Should be making the self friends stuff null if bot acc --- lib/Client/InternalClient.js | 6 +++--- src/Client/InternalClient.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/Client/InternalClient.js b/lib/Client/InternalClient.js index a2e10c6b0..d73306931 100644 --- a/lib/Client/InternalClient.js +++ b/lib/Client/InternalClient.js @@ -1585,9 +1585,9 @@ var InternalClient = (function () { } }); } else { - data.friends = null; - data.incoming_friend_requests = null; - data.outgoing_friend_requests = null; + self.friends = null; + self.incoming_friend_requests = null; + self.outgoing_friend_requests = null; } self.state = _ConnectionState2["default"].READY; diff --git a/src/Client/InternalClient.js b/src/Client/InternalClient.js index 931b49927..c44da3c34 100644 --- a/src/Client/InternalClient.js +++ b/src/Client/InternalClient.js @@ -1321,9 +1321,9 @@ export default class InternalClient { } }); } else { - data.friends = null; - data.incoming_friend_requests = null; - data.outgoing_friend_requests = null; + self.friends = null; + self.incoming_friend_requests = null; + self.outgoing_friend_requests = null; } self.state = ConnectionState.READY;