mirror of
https://github.com/danbulant/discord.js
synced 2026-05-26 05:22:15 +00:00
Merge pull request #264 from nicholastay/patch-2
Voice State Update crash & small friends property fix
This commit is contained in:
commit
b6d1cb88cd
2 changed files with 13 additions and 10 deletions
|
|
@ -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;
|
||||
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue