mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
simplify client destruction
This commit is contained in:
@@ -234,16 +234,14 @@ class Client extends EventEmitter {
|
||||
* @returns {Promise}
|
||||
*/
|
||||
destroy() {
|
||||
return new Promise((resolve, reject) => {
|
||||
for (const t of this._timeouts) clearTimeout(t);
|
||||
for (const i of this._intervals) clearInterval(i);
|
||||
this._timeouts = [];
|
||||
this._intervals = [];
|
||||
this.token = null;
|
||||
this.email = null;
|
||||
this.password = null;
|
||||
this.manager.destroy().then(resolve).catch(reject);
|
||||
});
|
||||
for (const t of this._timeouts) clearTimeout(t);
|
||||
for (const i of this._intervals) clearInterval(i);
|
||||
this._timeouts = [];
|
||||
this._intervals = [];
|
||||
this.token = null;
|
||||
this.email = null;
|
||||
this.password = null;
|
||||
return this.manager.destroy();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user