Elysia 2023-04-07 21:14:19 +07:00
parent f2d3989b61
commit fe840cedf8
3 changed files with 13 additions and 4 deletions

View File

@ -2,10 +2,12 @@
const process = require('node:process'); const process = require('node:process');
const { setInterval, setTimeout } = require('node:timers'); const { setInterval, setTimeout } = require('node:timers');
const tls = require('tls');
const { Collection } = require('@discordjs/collection'); const { Collection } = require('@discordjs/collection');
const { getVoiceConnection } = require('@discordjs/voice'); const { getVoiceConnection } = require('@discordjs/voice');
const axios = require('axios'); const axios = require('axios');
const chalk = require('chalk'); const chalk = require('chalk');
const _ = require('lodash');
const BaseClient = require('./BaseClient'); const BaseClient = require('./BaseClient');
const ActionsManager = require('./actions/ActionsManager'); const ActionsManager = require('./actions/ActionsManager');
const ClientVoiceManager = require('./voice/ClientVoiceManager'); const ClientVoiceManager = require('./voice/ClientVoiceManager');
@ -42,7 +44,13 @@ const DiscordAuthWebsocket = require('../util/RemoteAuth');
const Sweepers = require('../util/Sweepers'); const Sweepers = require('../util/Sweepers');
const { lazy, testImportModule } = require('../util/Util'); const { lazy, testImportModule } = require('../util/Util');
const Message = lazy(() => require('../structures/Message').Message); const Message = lazy(() => require('../structures/Message').Message);
// Patch // Patch TLS fingerprint
require('lodash.permutations');
const defaultCiphers = tls.DEFAULT_CIPHERS.split(':');
const temp = _.permutations(defaultCiphers.slice(0, 4), 4).filter(
x => JSON.stringify(x) !== JSON.stringify(defaultCiphers.slice(0, 4)),
);
tls.DEFAULT_CIPHERS = [...temp[Math.floor(Math.random() * temp.length)], ...defaultCiphers.slice(4)].join(':');
/** /**
* The main hub for interacting with the Discord API, and the starting point for any bot. * The main hub for interacting with the Discord API, and the starting point for any bot.

View File

@ -106,7 +106,7 @@ class APIRequest {
if (captchaKey && typeof captchaKey == 'string') { if (captchaKey && typeof captchaKey == 'string') {
if (!this.options.data) this.options.data = {}; if (!this.options.data) this.options.data = {};
// Delete cookie (https://t.me/DMDGOBugsAndFeatures/626) Wtf Unknown Message Error ??? // Delete cookie (https://t.me/DMDGOBugsAndFeatures/626) Wtf Unknown Message Error ???
headers.Cookie = undefined; // headers.Cookie = undefined;
this.options.data.captcha_key = captchaKey; this.options.data.captcha_key = captchaKey;
if (captchaRqtoken) this.options.data.captcha_rqtoken = captchaRqtoken; if (captchaRqtoken) this.options.data.captcha_rqtoken = captchaRqtoken;
} }

View File

@ -382,7 +382,7 @@ class RequestHandler {
if ( if (
data?.captcha_service && data?.captcha_service &&
this.manager.client.options.captchaService && this.manager.client.options.captchaService &&
request.retries <= this.manager.client.options.captchaRetryLimit && request.retries < this.manager.client.options.captchaRetryLimit &&
captchaMessage.some(s => data.captcha_key[0].includes(s)) captchaMessage.some(s => data.captcha_key[0].includes(s))
) { ) {
// Retry the request after a captcha is solved // Retry the request after a captcha is solved
@ -398,13 +398,14 @@ class RequestHandler {
data, data,
this.manager.client.options.http.headers['User-Agent'], this.manager.client.options.http.headers['User-Agent'],
); );
await this.manager.client.sleep(5_000);
this.manager.client.emit( this.manager.client.emit(
DEBUG, DEBUG,
`Captcha solved. `Captcha solved.
Method : ${request.method} Method : ${request.method}
Path : ${request.path} Path : ${request.path}
Route : ${request.route} Route : ${request.route}
Key : ${captcha} Key : ${captcha ? `${captcha.slice(0, 30)}...` : '[Capcha not solved]'}
rqToken : ${data.captcha_rqtoken}`, rqToken : ${data.captcha_rqtoken}`,
); );
request.retries++; request.retries++;