mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 16:43:31 +01:00
fix setTyping and many other timeout/interval based methods
This commit is contained in:
@@ -158,15 +158,19 @@ class Client extends EventEmitter {
|
||||
}
|
||||
|
||||
setInterval(...params) {
|
||||
this._intervals.push(setInterval(...params));
|
||||
const interval = setInterval(...params);
|
||||
this._intervals.push(interval);
|
||||
return interval;
|
||||
}
|
||||
|
||||
setTimeout(...params) {
|
||||
const restParams = params.slice(1);
|
||||
this._timeouts.push(setTimeout(() => {
|
||||
const timeout = setTimeout(() => {
|
||||
this._timeouts.splice(this._timeouts.indexOf(params[0]), 1);
|
||||
params[0]();
|
||||
}, ...restParams));
|
||||
}, ...restParams);
|
||||
this._timeouts.push(timeout);
|
||||
return timeout;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user