mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 03:23:29 +01:00
Merge branch 'indev' of https://github.com/hydrabolt/discord.js into indev
This commit is contained in:
@@ -234,14 +234,17 @@ class Client extends EventEmitter {
|
|||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
destroy() {
|
destroy() {
|
||||||
return this.manager.destroy().then(() => {
|
return new Promise((resolve, reject) => {
|
||||||
for (const t of this._timeouts) clearTimeout(t);
|
this.manager.destroy().then(() => {
|
||||||
for (const i of this._intervals) clearInterval(i);
|
for (const t of this._timeouts) clearTimeout(t);
|
||||||
this._timeouts.clear();
|
for (const i of this._intervals) clearInterval(i);
|
||||||
this._intervals.clear();
|
this._timeouts = [];
|
||||||
this.token = null;
|
this._intervals = [];
|
||||||
this.email = null;
|
this.token = null;
|
||||||
this.password = null;
|
this.email = null;
|
||||||
|
this.password = null;
|
||||||
|
resolve();
|
||||||
|
}).catch(reject);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,11 +58,14 @@ class ClientManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
destroy() {
|
destroy() {
|
||||||
let p = Promise.resolve();
|
return new Promise((resolve) => {
|
||||||
if (!this.client.user.bot) {
|
if (!this.client.user.bot) {
|
||||||
p = this.client.rest.methods.logout();
|
this.client.rest.methods.logout().then(resolve);
|
||||||
}
|
} else {
|
||||||
return p.then(() => this.client.ws.destroy());
|
this.client.ws.destroy();
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class RESTMethods {
|
|||||||
}
|
}
|
||||||
|
|
||||||
logout() {
|
logout() {
|
||||||
return this.rest.makeRequest('post', Constants.Endpoints.logout, true, {});
|
return this.rest.makeRequest('post', Constants.Endpoints.logout, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
getGateway() {
|
getGateway() {
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const Discord = require('../');
|
|
||||||
|
|
||||||
const client = new Discord.Client({ fetch_all_members: false, api_request_method: 'sequential' });
|
|
||||||
|
|
||||||
const { email, password, token } = require('./auth.json');
|
|
||||||
|
|
||||||
let p = client.login(token);
|
|
||||||
p = p.then(() => client.destroy());
|
|
||||||
p = p.then(() => client.login(token));
|
|
||||||
p = p.then(() => client.destroy());
|
|
||||||
Reference in New Issue
Block a user