From 45632b2eae6791dadf1456f4ee0bc05888def12c Mon Sep 17 00:00:00 2001 From: Amish Shah Date: Wed, 26 Oct 2016 15:23:54 +0100 Subject: [PATCH] fix joining voice channels without perms --- src/client/voice/ClientVoiceManager.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/client/voice/ClientVoiceManager.js b/src/client/voice/ClientVoiceManager.js index eea0dc8a8..bd58989ee 100644 --- a/src/client/voice/ClientVoiceManager.js +++ b/src/client/voice/ClientVoiceManager.js @@ -80,6 +80,10 @@ class ClientVoiceManager { return new Promise((resolve, reject) => { if (this.pending.get(channel.guild.id)) throw new Error('Already connecting to this guild\'s voice server.'); + if (!channel.permissionsFor(this.client.user).hasPermission('CONNECT')) { + throw new Error('You do not have permission to join this voice channel'); + } + const existingConnection = this.connections.get(channel.guild.id); if (existingConnection) { if (existingConnection.channel.id !== channel.id) {