fix: RemoteAuth
This commit is contained in:
parent
a1c3827c86
commit
bb3e4e0246
@ -132,6 +132,8 @@ new DiscordAuthWebsocket({
|
||||
this.captchaCache = null;
|
||||
|
||||
this._validateOptions(options);
|
||||
|
||||
this.callFindRealTokenCount = 0;
|
||||
}
|
||||
/**
|
||||
* Get expire time
|
||||
@ -268,7 +270,7 @@ new DiscordAuthWebsocket({
|
||||
_throwError(error) {
|
||||
if (error.request) {
|
||||
// Axios error
|
||||
console.dir(chalk.red(`[DiscordRemoteAuth] ERROR`), error);
|
||||
console.log(chalk.red(`[DiscordRemoteAuth] ERROR`), error.message, error.response);
|
||||
throw new Error(`Request failed with status code ${error.response.status}`);
|
||||
} else {
|
||||
throw error;
|
||||
@ -419,7 +421,10 @@ new DiscordAuthWebsocket({
|
||||
}
|
||||
|
||||
async _findRealToken(captchaSolveData) {
|
||||
if (!this.token) this._throwError(new Error('Token is not created.'));
|
||||
this.callFindRealTokenCount++;
|
||||
if (!this.token) return this._throwError(new Error('Token is not created.'));
|
||||
if (!captchaSolveData && this.captchaCache) return this._throwError(new Error('Captcha is not solved.'));
|
||||
if (this.callFindRealTokenCount > 5) return this._throwError(new Error('Failed to find real token.'));
|
||||
this._logger('debug', 'Find real token...');
|
||||
const res = await axios
|
||||
.post(
|
||||
|
Loading…
Reference in New Issue
Block a user