mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 12:33:30 +01:00
Fix for when other users move from different server to another across voice
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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