Fix for when other users move from different server to another across voice

This commit is contained in:
Nicholas Tay
2016-04-11 00:38:38 +10:00
parent bf78c441dd
commit db1435910d
2 changed files with 7 additions and 4 deletions

View File

@@ -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

View File

@@ -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