mirror of
https://github.com/danbulant/discord.js
synced 2026-06-19 22:51:32 +00:00
parent
1672465768
commit
e59dd9b12a
2 changed files with 8 additions and 12 deletions
|
|
@ -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();
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue