mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23:30 +01:00
Add client.destroy();
This commit is contained in:
@@ -35,7 +35,7 @@ class ClientManager {
|
||||
})
|
||||
.catch(reject);
|
||||
|
||||
setTimeout(() => reject(Constants.Errors.TOOK_TOO_LONG), 1000 * 300);
|
||||
this.client.setTimeout(() => reject(Constants.Errors.TOOK_TOO_LONG), 1000 * 300);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -44,13 +44,24 @@ class ClientManager {
|
||||
* @returns {null}
|
||||
*/
|
||||
setupKeepAlive(time) {
|
||||
this.heartbeatInterval = setInterval(() => {
|
||||
this.heartbeatInterval = this.client.setInterval(() => {
|
||||
this.client.ws.send({
|
||||
op: Constants.OPCodes.HEARTBEAT,
|
||||
d: Date.now(),
|
||||
});
|
||||
}, time);
|
||||
}
|
||||
|
||||
destroy() {
|
||||
return new Promise((resolve) => {
|
||||
if (!this.client.user.bot) {
|
||||
this.client.rest.methods.logout().then(resolve);
|
||||
} else {
|
||||
this.client.ws.destroy();
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ClientManager;
|
||||
|
||||
Reference in New Issue
Block a user