mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 02:53:31 +01:00
fix setTyping and many other timeout/interval based methods
This commit is contained in:
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user