mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 00:53:31 +01:00
17 lines
496 B
JavaScript
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));
|
|
});
|
|
};
|