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

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "discord.js-selfbot-v13", "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]", "description": "A unofficial discord.js fork for creating selfbots [Based on discord.js v13]",
"main": "./src/index.js", "main": "./src/index.js",
"types": "./typings/index.d.ts", "types": "./typings/index.d.ts",

View File

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

View File

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