mirror of
https://github.com/danbulant/discord.js
synced 2026-05-24 20:42:27 +00:00
Fix feature/login (#790)
* eeeeeeee * too tired * ok gawdl3y Signed-off-by: Gus Caplan <fluffyrobotcheese@gmail.com>
This commit is contained in:
parent
5ddefc3682
commit
32eeb8ad5e
2 changed files with 3 additions and 2 deletions
|
|
@ -20,7 +20,7 @@ class Client extends EventEmitter {
|
|||
/**
|
||||
* @param {ClientOptions} [options] Options for the client
|
||||
*/
|
||||
constructor(options) {
|
||||
constructor(options = {}) {
|
||||
super();
|
||||
|
||||
// Obtain shard details from environment
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ class RESTMethods {
|
|||
}
|
||||
|
||||
loginToken(token) {
|
||||
token = token.replace('Bot ', '');
|
||||
return new Promise((resolve, reject) => {
|
||||
this.rest.client.manager.connectToWebSocket(token, resolve, reject);
|
||||
});
|
||||
|
|
@ -27,7 +28,7 @@ class RESTMethods {
|
|||
this.rest.client.password = password;
|
||||
this.rest.makeRequest('post', Constants.Endpoints.login, false, { email, password })
|
||||
.then(data => {
|
||||
this.rest.client.manager.connectToWebSocket(data.token, resolve, reject);
|
||||
resolve(this.loginToken(data.token));
|
||||
})
|
||||
.catch(reject);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue