fix: RemoteAuth
This commit is contained in:
parent
a1c3827c86
commit
bb3e4e0246
@ -132,6 +132,8 @@ new DiscordAuthWebsocket({
|
|||||||
this.captchaCache = null;
|
this.captchaCache = null;
|
||||||
|
|
||||||
this._validateOptions(options);
|
this._validateOptions(options);
|
||||||
|
|
||||||
|
this.callFindRealTokenCount = 0;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Get expire time
|
* Get expire time
|
||||||
@ -268,7 +270,7 @@ new DiscordAuthWebsocket({
|
|||||||
_throwError(error) {
|
_throwError(error) {
|
||||||
if (error.request) {
|
if (error.request) {
|
||||||
// Axios error
|
// 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}`);
|
throw new Error(`Request failed with status code ${error.response.status}`);
|
||||||
} else {
|
} else {
|
||||||
throw error;
|
throw error;
|
||||||
@ -419,7 +421,10 @@ new DiscordAuthWebsocket({
|
|||||||
}
|
}
|
||||||
|
|
||||||
async _findRealToken(captchaSolveData) {
|
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...');
|
this._logger('debug', 'Find real token...');
|
||||||
const res = await axios
|
const res = await axios
|
||||||
.post(
|
.post(
|
||||||
|
Loading…
Reference in New Issue
Block a user