Files
discord.js/src/rest/handlers/sequential.js
Gus Caplan 18e3801bb7 lots of important stuff (#1883)
* lots of important stuff

* Update Constants.js
2017-09-04 17:49:44 +02:00

17 lines
496 B
JavaScript

module.exports = function sequential() {
if (this.busy || this.limited || this.queue.length === 0) return;
this.busy = true;
this.execute(this.queue.shift())
.then(() => {
this.busy = false;
this.handle();
})
.catch(({ timeout }) => {
this.client.setTimeout(() => {
this.reset();
this.busy = false;
this.handle();
}, timeout || (this.resetTime - Date.now() + this.timeDifference + this.client.options.restTimeOffset));
});
};