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,10 +46,14 @@ 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
// eslint-disable-next-line no-async-promise-executor
new Promise(async (resolve, reject) => {
try { try {
const createTaskResponse = await axios.post('https://api.capmonster.cloud/createTask', { const createTaskResponse = await axios.post(
'https://api.capmonster.cloud/createTask',
{
clientKey: this.key, clientKey: this.key,
task: { task: {
type: 'HCaptchaTask', type: 'HCaptchaTask',
@ -59,7 +63,14 @@ module.exports = class CaptchaSolver {
isInvisible: !!captchaData.captcha_rqdata, isInvisible: !!captchaData.captcha_rqdata,
userAgent: userAgent, userAgent: userAgent,
}, },
}); },
{
headers: {
'Content-Type': 'application/json',
'user-agent': userAgent,
},
},
);
const taskId = createTaskResponse.data.taskId; const taskId = createTaskResponse.data.taskId;
let getResults = { status: 'processing' }; let getResults = { status: 'processing' };
while (getResults.status === 'processing') { while (getResults.status === 'processing') {
@ -68,14 +79,16 @@ module.exports = class CaptchaSolver {
taskId, taskId,
}); });
getResults = getResultsResponse.data; getResults = getResultsResponse.data;
await new Promise(resolve => setTimeout(resolve, 1500).unref()); await new Promise(resolve_ => setTimeout(resolve_, 1500).unref());
} }
const solution = getResults.solution.gRecaptchaResponse; const solution = getResults.solution.gRecaptchaResponse;
return await solution; return resolve(await solution);
} catch (e) { } catch (e) {
throw new Error('Capmonster API error', e); // !console.error(e);
reject(new Error(`Capmonster error: ${e.message}`, e?.response?.data));
} }
}; return true;
});
break; break;
} }
default: { default: {