mirror of
https://github.com/danbulant/discord.js
synced 2026-06-19 14:41:36 +00:00
Webpack build for branch master: 3ace61a179
This commit is contained in:
parent
c9ddb0b14e
commit
97e96e58af
2 changed files with 4 additions and 2 deletions
|
|
@ -22428,6 +22428,7 @@ const Messages = {
|
|||
|
||||
FEATURE_USER_ONLY: 'Only user accounts are able to make use of this feature.',
|
||||
|
||||
WS_CONNECTION_TIMEOUT: 'The connection to the gateway timed out.',
|
||||
WS_CONNECTION_EXISTS: 'There is already an existing WebSocket connection.',
|
||||
WS_NOT_OPEN: (data = 'data') => `Websocket not open to send ${data}`,
|
||||
|
||||
|
|
@ -23337,11 +23338,12 @@ class ClientManager {
|
|||
connectToWebSocket(token, resolve, reject) {
|
||||
this.client.emit(Events.DEBUG, `Authenticated using token ${token}`);
|
||||
this.client.token = token;
|
||||
const timeout = this.client.setTimeout(() => reject(new Error('TOKEN_INVALID')), 1000 * 300);
|
||||
const timeout = this.client.setTimeout(() => reject(new Error('WS_CONNECTION_TIMEOUT')), 1000 * 300);
|
||||
this.client.api.gateway.get().then(res => {
|
||||
const gateway = `${res.url}/`;
|
||||
this.client.emit(Events.DEBUG, `Using gateway ${gateway}`);
|
||||
this.client.ws.connect(gateway);
|
||||
this.client.ws.connection.ws.once('error', reject);
|
||||
this.client.ws.connection.once('close', event => {
|
||||
if (event.code === 4004) reject(new Error('TOKEN_INVALID'));
|
||||
if (event.code === 4010) reject(new Error('SHARDING_INVALID'));
|
||||
|
|
|
|||
2
discord.master.min.js
vendored
2
discord.master.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue