Fix feature/login (#790)

* eeeeeeee

* too tired

* ok gawdl3y

Signed-off-by: Gus Caplan <fluffyrobotcheese@gmail.com>
This commit is contained in:
Gus Caplan
2016-10-10 01:55:09 -05:00
committed by Schuyler Cebulskie
parent 5ddefc3682
commit 32eeb8ad5e
2 changed files with 3 additions and 2 deletions

View File

@@ -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

View File

@@ -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);
});