fix: Cannot destructure property 'url' of '(intermediate value)' as it is undefined.

This commit is contained in:
Elysia 2023-04-24 22:07:28 +07:00
parent 00418e59be
commit 3397d8da71

View File

@ -140,13 +140,14 @@ class WebSocketManager extends EventEmitter {
*/
let gatewayURL = 'wss://gateway.discord.gg';
const { url } = await this.client.api.gateway
.get({ auth: false })
// eslint-disable-next-line no-unused-vars
const { url } = await this.client.api.gateway.get({ auth: false }).catch(() => ({ url: gatewayURL }));
// eslint-disable-next-line no-unused-vars
/*
.catch(error => {
// Never throw error :v
// throw error.httpStatus === 401 ? invalidToken : error;
});
*/
if (url) gatewayURL = url;
const recommendedShards = 1;
const sessionStartLimit = {