Revert "fix Client.destroy bugs" (#839)

This commit is contained in:
Amish Shah
2016-10-26 17:30:18 +01:00
committed by GitHub
parent 18e9850e1e
commit 7d04863b66
4 changed files with 20 additions and 26 deletions

View File

@@ -58,11 +58,14 @@ class ClientManager {
}
destroy() {
let p = Promise.resolve();
if (!this.client.user.bot) {
p = this.client.rest.methods.logout();
}
return p.then(() => this.client.ws.destroy());
return new Promise((resolve) => {
if (!this.client.user.bot) {
this.client.rest.methods.logout().then(resolve);
} else {
this.client.ws.destroy();
resolve();
}
});
}
}