diff --git a/lib/Client/InternalClient.js b/lib/Client/InternalClient.js index baa011ce7..ecc2863ee 100644 --- a/lib/Client/InternalClient.js +++ b/lib/Client/InternalClient.js @@ -370,9 +370,7 @@ var InternalClient = (function () { var timeout = null; - var check = function check(m) { - var data = JSON.parse(m); - + var check = function check(data) { if (data.t === "VOICE_SERVER_UPDATE") { if (data.d.guild_id !== server.id) return; // ensure it is the right server token = data.d.token; @@ -389,16 +387,16 @@ var InternalClient = (function () { if (timeout) { clearTimeout(timeout); } - _this5.websocket.removeListener("message", check); + _this5.client.removeListener("raw", check); } }; timeout = setTimeout(function () { - _this5.websocket.removeListener("message", check); + _this5.client.removeListener("raw", check); reject(new Error("No voice server details within 10 seconds")); }, 10000); - _this5.websocket.on("message", check); + _this5.client.on("raw", check); joinSendWS(); }); }; diff --git a/src/Client/InternalClient.js b/src/Client/InternalClient.js index 1b5162052..7ed897ba8 100644 --- a/src/Client/InternalClient.js +++ b/src/Client/InternalClient.js @@ -290,9 +290,7 @@ export default class InternalClient { var timeout = null; - var check = m => { - var data = JSON.parse(m); - + var check = data => { if (data.t === "VOICE_SERVER_UPDATE") { if (data.d.guild_id !== server.id) return // ensure it is the right server token = data.d.token; @@ -309,16 +307,16 @@ export default class InternalClient { if (timeout) { clearTimeout(timeout); } - this.websocket.removeListener("message", check); + this.client.removeListener("raw", check); } }; timeout = setTimeout(() => { - this.websocket.removeListener("message", check); + this.client.removeListener("raw", check); reject(new Error("No voice server details within 10 seconds")); }, 10000); - this.websocket.on("message", check); + this.client.on("raw", check); joinSendWS(); }); }