From c773ea4e497b717d56251b20154486850bd0390d Mon Sep 17 00:00:00 2001 From: meew0 Date: Mon, 1 Feb 2016 21:34:32 +0100 Subject: [PATCH] Check before a channel is a voice channel before joining it --- lib/Client/InternalClient.js | 5 +++++ src/Client/InternalClient.js | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/lib/Client/InternalClient.js b/lib/Client/InternalClient.js index 4f1546fd6..715a36be3 100644 --- a/lib/Client/InternalClient.js +++ b/lib/Client/InternalClient.js @@ -273,6 +273,11 @@ var InternalClient = (function () { if (!channel) { return Promise.reject(new Error("voice channel does not exist")); } + + if (channel.type !== 'voice') { + return Promise.reject(new Error("channel is not a voice channel!")); + } + return _this3.leaveVoiceChannel().then(function () { return new Promise(function (resolve, reject) { var session, diff --git a/src/Client/InternalClient.js b/src/Client/InternalClient.js index 7a026d278..a4e64d532 100644 --- a/src/Client/InternalClient.js +++ b/src/Client/InternalClient.js @@ -204,6 +204,11 @@ export default class InternalClient { if (!channel) { return Promise.reject(new Error("voice channel does not exist")); } + + if (channel.type !== 'voice') { + return Promise.reject(new Error("channel is not a voice channel!")); + } + return this.leaveVoiceChannel() .then(() => { return new Promise((resolve, reject) => {