chore: v2.11.3

This commit is contained in:
Elysia 2023-03-05 19:04:04 +07:00
parent 3d44ff54f7
commit f4a6212ed4
5 changed files with 47 additions and 31 deletions

View File

@ -39,7 +39,7 @@
- [x] User: Settings, Status, Activity, DeveloperPortal, RemoteAuth, etc.
- [X] Guild: Fetch Members, Join / Leave, Top emojis, ...
- [X] Interactions: Slash Commands, Click Buttons, Menu, Modal, Context Menu, ...
- [X] Captcha Handler
- [X] Captcha Handler (2captcha, capmonster, custom)
- [X] Documentation
- [x] Voice & [Video stream](https://github.com/aiko-chan-ai/discord.js-selfbot-v13/issues/293)
- [ ] Everything

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"name": "discord.js-selfbot-v13",
"version": "2.11.2",
"version": "2.11.3",
"description": "A unofficial discord.js fork for creating selfbots [Based on discord.js v13]",
"main": "./src/index.js",
"types": "./typings/index.d.ts",

View File

@ -1034,6 +1034,9 @@ class Client extends BaseClient {
}
break;
case 'capmonster':
if (options.captchaKey.length !== 32) {
throw new TypeError('CLIENT_INVALID_OPTION', 'captchaKey', 'a 32 character string');
}
break;
}
}

View File

@ -46,36 +46,49 @@ module.exports = class CaptchaSolver {
if (!key || typeof key !== 'string') throw new Error('Capmonster key is not provided');
this.service = 'capmonster';
this.key = key;
this.solve = async (captchaData, userAgent) => {
this.solve = (captchaData, userAgent) =>
// https://github.com/aiko-chan-ai/discord.js-selfbot-v13/issues/548#issuecomment-1452091328
try {
const createTaskResponse = await axios.post('https://api.capmonster.cloud/createTask', {
clientKey: this.key,
task: {
type: 'HCaptchaTask',
websiteURL: 'https://discord.com/channels/@me',
websiteKey: captchaData.captcha_sitekey,
data: captchaData.captcha_rqdata,
isInvisible: !!captchaData.captcha_rqdata,
userAgent: userAgent,
},
});
const taskId = createTaskResponse.data.taskId;
let getResults = { status: 'processing' };
while (getResults.status === 'processing') {
const getResultsResponse = await axios.post('https://api.capmonster.cloud/getTaskResult', {
clientKey: this.key,
taskId,
});
getResults = getResultsResponse.data;
await new Promise(resolve => setTimeout(resolve, 1500).unref());
// eslint-disable-next-line no-async-promise-executor
new Promise(async (resolve, reject) => {
try {
const createTaskResponse = await axios.post(
'https://api.capmonster.cloud/createTask',
{
clientKey: this.key,
task: {
type: 'HCaptchaTask',
websiteURL: 'https://discord.com/channels/@me',
websiteKey: captchaData.captcha_sitekey,
data: captchaData.captcha_rqdata,
isInvisible: !!captchaData.captcha_rqdata,
userAgent: userAgent,
},
},
{
headers: {
'Content-Type': 'application/json',
'user-agent': userAgent,
},
},
);
const taskId = createTaskResponse.data.taskId;
let getResults = { status: 'processing' };
while (getResults.status === 'processing') {
const getResultsResponse = await axios.post('https://api.capmonster.cloud/getTaskResult', {
clientKey: this.key,
taskId,
});
getResults = getResultsResponse.data;
await new Promise(resolve_ => setTimeout(resolve_, 1500).unref());
}
const solution = getResults.solution.gRecaptchaResponse;
return resolve(await solution);
} catch (e) {
// !console.error(e);
reject(new Error(`Capmonster error: ${e.message}`, e?.response?.data));
}
const solution = getResults.solution.gRecaptchaResponse;
return await solution;
} catch (e) {
throw new Error('Capmonster API error', e);
}
};
return true;
});
break;
}
default: {