mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
Fix feature/login (#790)
* eeeeeeee * too tired * ok gawdl3y Signed-off-by: Gus Caplan <fluffyrobotcheese@gmail.com>
This commit is contained in:
committed by
Schuyler Cebulskie
parent
5ddefc3682
commit
32eeb8ad5e
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user