mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 12:03:31 +01:00
Handle incomplete websocket message (#413)
Sometimes the VOICE_SERVER_UPDATE packet will contain a valid guild_id but no token/endpoint.
This commit is contained in:
@@ -375,6 +375,7 @@ var InternalClient = (function () {
|
|||||||
if (data.d.guild_id !== server.id) return; // ensure it is the right server
|
if (data.d.guild_id !== server.id) return; // ensure it is the right server
|
||||||
token = data.d.token;
|
token = data.d.token;
|
||||||
endpoint = data.d.endpoint;
|
endpoint = data.d.endpoint;
|
||||||
|
if (!token || !endpoint) return;
|
||||||
var chan = new _VoiceVoiceConnection2["default"](channel, _this5.client, session, token, server, endpoint);
|
var chan = new _VoiceVoiceConnection2["default"](channel, _this5.client, session, token, server, endpoint);
|
||||||
_this5.voiceConnections.add(chan);
|
_this5.voiceConnections.add(chan);
|
||||||
|
|
||||||
|
|||||||
@@ -292,9 +292,10 @@ export default class InternalClient {
|
|||||||
|
|
||||||
var check = data => {
|
var check = data => {
|
||||||
if (data.t === "VOICE_SERVER_UPDATE") {
|
if (data.t === "VOICE_SERVER_UPDATE") {
|
||||||
if (data.d.guild_id !== server.id) return // ensure it is the right server
|
if (data.d.guild_id !== server.id) return; // ensure it is the right server
|
||||||
token = data.d.token;
|
token = data.d.token;
|
||||||
endpoint = data.d.endpoint;
|
endpoint = data.d.endpoint;
|
||||||
|
if (!token || !endpoint) return;
|
||||||
var chan = new VoiceConnection(
|
var chan = new VoiceConnection(
|
||||||
channel, this.client, session, token, server, endpoint
|
channel, this.client, session, token, server, endpoint
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user