fix(Voice): disconnect if voice channel not cached (#5467)

This commit is contained in:
Amish Shah
2021-04-02 11:53:49 +01:00
committed by iCrawl
parent 6e11596cb1
commit 5291fe11a3

View File

@@ -56,8 +56,14 @@ class ClientVoiceManager {
this.connections.delete(guild_id);
return;
}
connection.channel = this.client.channels.cache.get(channel_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();
}
}
/**