mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23:30 +01:00
19 lines
443 B
JavaScript
19 lines
443 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 }) => {
|
|
if (timeout) {
|
|
this.client.setTimeout(() => {
|
|
this.reset();
|
|
this.busy = false;
|
|
this.handle();
|
|
}, timeout);
|
|
}
|
|
});
|
|
};
|