mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 03:23:29 +01:00
fix(ws): set correct ratelimit remaining after reset or destroy (#1806)
This commit is contained in:
@@ -191,9 +191,9 @@ class WebSocketConnection extends EventEmitter {
|
|||||||
processQueue() {
|
processQueue() {
|
||||||
if (this.ratelimit.remaining === 0) return;
|
if (this.ratelimit.remaining === 0) return;
|
||||||
if (this.ratelimit.queue.length === 0) return;
|
if (this.ratelimit.queue.length === 0) return;
|
||||||
if (this.ratelimit.remaining === 120) {
|
if (this.ratelimit.remaining === this.ratelimit.total) {
|
||||||
this.ratelimit.resetTimer = this.client.setTimeout(() => {
|
this.ratelimit.resetTimer = this.client.setTimeout(() => {
|
||||||
this.ratelimit.remaining = 60;
|
this.ratelimit.remaining = this.ratelimit.total;
|
||||||
this.processQueue();
|
this.processQueue();
|
||||||
}, this.ratelimit.time);
|
}, this.ratelimit.time);
|
||||||
}
|
}
|
||||||
@@ -277,6 +277,7 @@ class WebSocketConnection extends EventEmitter {
|
|||||||
this.packetManager.handleQueue();
|
this.packetManager.handleQueue();
|
||||||
this.ws = null;
|
this.ws = null;
|
||||||
this.status = Constants.Status.DISCONNECTED;
|
this.status = Constants.Status.DISCONNECTED;
|
||||||
|
this.ratelimit.remaining = this.ratelimit.total;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user