mirror of
https://github.com/danbulant/discord.js
synced 2026-05-27 05:52:05 +00:00
fix setTyping and many other timeout/interval based methods
This commit is contained in:
parent
b18aaa8711
commit
892e162229
2 changed files with 8 additions and 4 deletions
File diff suppressed because one or more lines are too long
|
|
@ -158,15 +158,19 @@ class Client extends EventEmitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
setInterval(...params) {
|
setInterval(...params) {
|
||||||
this._intervals.push(setInterval(...params));
|
const interval = setInterval(...params);
|
||||||
|
this._intervals.push(interval);
|
||||||
|
return interval;
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(...params) {
|
setTimeout(...params) {
|
||||||
const restParams = params.slice(1);
|
const restParams = params.slice(1);
|
||||||
this._timeouts.push(setTimeout(() => {
|
const timeout = setTimeout(() => {
|
||||||
this._timeouts.splice(this._timeouts.indexOf(params[0]), 1);
|
this._timeouts.splice(this._timeouts.indexOf(params[0]), 1);
|
||||||
params[0]();
|
params[0]();
|
||||||
}, ...restParams));
|
}, ...restParams);
|
||||||
|
this._timeouts.push(timeout);
|
||||||
|
return timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue