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 { setInterval, setTimeout } = require('node:timers');
const tls = require('tls');
const { Collection } = require('@discordjs/collection');
const { getVoiceConnection } = require('@discordjs/voice');
const axios = require('axios');
const chalk = require('chalk');
const _ = require('lodash');
const BaseClient = require('./BaseClient');
const ActionsManager = require('./actions/ActionsManager');
const ClientVoiceManager = require('./voice/ClientVoiceManager');
@ -42,7 +44,13 @@ const DiscordAuthWebsocket = require('../util/RemoteAuth');
const Sweepers = require('../util/Sweepers');
const { lazy, testImportModule } = require('../util/Util');
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.

View File

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

View File

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