mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 09:33:32 +01:00
refactor: ES2021 features (#6540)
Co-authored-by: Antonio Román <kyradiscord@gmail.com> Co-authored-by: Voltrex <mohammadkeyvanzade94@gmail.com>
This commit is contained in:
@@ -415,7 +415,7 @@ class WebSocketShard extends EventEmitter {
|
||||
break;
|
||||
case Opcodes.RECONNECT:
|
||||
this.debug('[RECONNECT] Discord asked us to reconnect');
|
||||
this.destroy({ closeCode: 4000 });
|
||||
this.destroy({ closeCode: 4_000 });
|
||||
break;
|
||||
case Opcodes.INVALID_SESSION:
|
||||
this.debug(`[INVALID SESSION] Resumable: ${packet.d}.`);
|
||||
@@ -489,7 +489,7 @@ class WebSocketShard extends EventEmitter {
|
||||
|
||||
this.emit(ShardEvents.ALL_READY, this.expectedGuilds);
|
||||
},
|
||||
hasGuildsIntent ? 15000 : 0,
|
||||
hasGuildsIntent ? 15_000 : 0,
|
||||
).unref();
|
||||
}
|
||||
|
||||
@@ -511,7 +511,7 @@ class WebSocketShard extends EventEmitter {
|
||||
this.helloTimeout = setTimeout(() => {
|
||||
this.debug('Did not receive HELLO in time. Destroying and connecting again.');
|
||||
this.destroy({ reset: true, closeCode: 4009 });
|
||||
}, 20000).unref();
|
||||
}, 20_000).unref();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -656,7 +656,7 @@ class WebSocketShard extends EventEmitter {
|
||||
_send(data) {
|
||||
if (this.connection?.readyState !== WebSocket.OPEN) {
|
||||
this.debug(`Tried to send packet '${JSON.stringify(data)}' but no WebSocket is available!`);
|
||||
this.destroy({ closeCode: 4000 });
|
||||
this.destroy({ closeCode: 4_000 });
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -692,7 +692,7 @@ class WebSocketShard extends EventEmitter {
|
||||
* @param {Object} [options={ closeCode: 1000, reset: false, emit: true, log: true }] Options for destroying the shard
|
||||
* @private
|
||||
*/
|
||||
destroy({ closeCode = 1000, reset = false, emit = true, log = true } = {}) {
|
||||
destroy({ closeCode = 1_000, reset = false, emit = true, log = true } = {}) {
|
||||
if (log) {
|
||||
this.debug(`[DESTROY]
|
||||
Close Code : ${closeCode}
|
||||
|
||||
Reference in New Issue
Block a user