mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 20:13:30 +01:00
Merge pull request #264 from nicholastay/patch-2
Voice State Update crash & small friends property fix
This commit is contained in:
@@ -1585,9 +1585,9 @@ var InternalClient = (function () {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
data.friends = null;
|
self.friends = null;
|
||||||
data.incoming_friend_requests = null;
|
self.incoming_friend_requests = null;
|
||||||
data.outgoing_friend_requests = null;
|
self.outgoing_friend_requests = null;
|
||||||
}
|
}
|
||||||
self.state = _ConnectionState2["default"].READY;
|
self.state = _ConnectionState2["default"].READY;
|
||||||
|
|
||||||
@@ -2083,9 +2083,11 @@ var InternalClient = (function () {
|
|||||||
client.emit("warn", "voice state update but user or server not in cache");
|
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
|
// existing connection, perhaps channel moved
|
||||||
if (connection.voiceChannel.id !== data.channel_id) {
|
if (connection && connection.voiceChannel.id !== data.channel_id) {
|
||||||
// moved, update info
|
// moved, update info
|
||||||
connection.voiceChannel = self.channels.get("id", data.channel_id);
|
connection.voiceChannel = self.channels.get("id", data.channel_id);
|
||||||
client.emit("voiceMoved", connection.voiceChannel); // Moved to a new channel
|
client.emit("voiceMoved", connection.voiceChannel); // Moved to a new channel
|
||||||
|
|||||||
@@ -1321,9 +1321,9 @@ export default class InternalClient {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
data.friends = null;
|
self.friends = null;
|
||||||
data.incoming_friend_requests = null;
|
self.incoming_friend_requests = null;
|
||||||
data.outgoing_friend_requests = null;
|
self.outgoing_friend_requests = null;
|
||||||
}
|
}
|
||||||
self.state = ConnectionState.READY;
|
self.state = ConnectionState.READY;
|
||||||
|
|
||||||
@@ -1771,9 +1771,10 @@ export default class InternalClient {
|
|||||||
client.emit("warn", "voice state update but user or server not in cache");
|
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
|
// existing connection, perhaps channel moved
|
||||||
if (connection.voiceChannel.id !== data.channel_id) {
|
if (connection && connection.voiceChannel.id !== data.channel_id) {
|
||||||
// moved, update info
|
// moved, update info
|
||||||
connection.voiceChannel = self.channels.get("id", data.channel_id);
|
connection.voiceChannel = self.channels.get("id", data.channel_id);
|
||||||
client.emit("voiceMoved", connection.voiceChannel); // Moved to a new channel
|
client.emit("voiceMoved", connection.voiceChannel); // Moved to a new channel
|
||||||
|
|||||||
Reference in New Issue
Block a user