mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 19:43:29 +01:00
2.6.2, cache error handling
This commit is contained in:
13
index.js
13
index.js
@@ -280,9 +280,15 @@ exports.Client.prototype.login = function( email, password, callback, noCache )
|
||||
self.connectWebsocket();
|
||||
|
||||
if ( this.tokenManager.exists( email ) && !noCache ) {
|
||||
done( this.tokenManager.getToken( email, password ) );
|
||||
self.debug("loaded token from caches in "+tp(globalLoginTime));
|
||||
return;
|
||||
|
||||
var token = this.tokenManager.getToken( email, password );
|
||||
if(!token.match(/[^\w.-]+/g)){
|
||||
done( this.tokenManager.getToken( email, password ) );
|
||||
self.debug("loaded token from caches in "+tp(globalLoginTime));
|
||||
return;
|
||||
}else{
|
||||
self.debug("error getting token from caches, using default auth");
|
||||
}
|
||||
}
|
||||
|
||||
var time = Date.now();
|
||||
@@ -305,6 +311,7 @@ exports.Client.prototype.login = function( email, password, callback, noCache )
|
||||
} );
|
||||
|
||||
function done( token ) {
|
||||
self.debug("using token " + token);
|
||||
self.token = token;
|
||||
self.websocket.sendData();
|
||||
self.loggedIn = true;
|
||||
|
||||
Reference in New Issue
Block a user