mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
fix(Voice): disconnect if voice channel not cached (#5467)
This commit is contained in:
@@ -56,8 +56,14 @@ class ClientVoiceManager {
|
||||
this.connections.delete(guild_id);
|
||||
return;
|
||||
}
|
||||
connection.channel = this.client.channels.cache.get(channel_id);
|
||||
connection.setSessionID(session_id);
|
||||
const channel = this.client.channels.cache.get(channel_id);
|
||||
if (channel) {
|
||||
connection.channel = channel;
|
||||
connection.setSessionID(session_id);
|
||||
} else {
|
||||
this.client.emit('debug', `[VOICE] disconnecting from guild ${guild_id} as channel ${channel_id} is uncached`);
|
||||
connection.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user