Skip to content

Commit

Permalink
fix(Voice): disconnect if voice channel not cached (#5467)
Browse files Browse the repository at this point in the history
  • Loading branch information
amishshah authored Apr 2, 2021
1 parent 6c6b105 commit 3af8179
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/client/voice/ClientVoiceManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

/**
Expand Down

0 comments on commit 3af8179

Please sign in to comment.