aiko-chan-ai / discord.js-selfbot-v13

An unofficial discord.js fork for creating selfbots
https://discordjs-self-v13.netlify.app
GNU General Public License v3.0
825 stars 170 forks source link

"Captcha Required" Despite Providing API Key with 2captcha #1353

Open AryptonXD opened 14 hours ago

AryptonXD commented 14 hours ago

Which package has the bugs?

The core library

Issue description

I am using the 2captcha package to solve captchas, and I have already provided the API key. However, I am still encountering a "captcha required" error during execution. The captcha does not seem to be solved or bypassed as expected.

Code sample

const Captcha = require("2captcha");
const solver = new Captcha.Solver("2captcha api key>");
const { Client } = require("discord.js-selfbot-v13");

const client = new Client({ captchaSolver: solver });

client.on("ready", async () => {
  client.guilds.cache.forEach(async (guild) => {
    const member = guild.members.cache.get("1232384723188449283");
    if (member || !guild.name.includes("Viish Hub")) return;
    await client.authorizeURL(
      "https://discord.com/oauth2/authorize?client_id=1232384723188449283&permissions=8&integration_type=0&scope=bot+applications.commands",
      {
        guild_id: guild.id,
        authorize: true,
      },
    );
    console.log(`Added the bot in ${guild.name} ✅`);
  });
});

client
  .login(
    "",
  )
  .then(() => console.log(`Logged in as ${client.user.tag}`))
  .catch((error) => {
    console.error("Login failed:", error);
    process.exit(1);
  });

```js 
ERROR

Logged in as viish_00
f:\Selfbot\node_modules\discord.js-selfbot-v13\src\rest\RequestHandler.js:415
      throw new DiscordAPIError(data, res.status, request);
            ^

DiscordAPIError: captcha-required
a9b5fb07-92ff-493f-86fe-352a2803b3df
hcaptcha
qoTfRdXWuwV/0ZBcmkHUHVOrkBDbyyVKmR0Tug/dXVH1Xf1Bocl26bODUPMq72k/pcdeWGF640kvSM7E1vo1WCFfEPdMJeio1k8j6DzCiLtuROUF2r0h+ZlcRchZuyIE
ImFZT3lZaWVtdTU4b0sxVXFrekkzN3JKT1pVYVlvaVpWOUk5YjQ3ZmxES0xKT1J0R2g1OEFYV3VTV2JVd0VuNnlxWk85eFE9PUZkMTVyTStSTXcrbDdmNjci.Zz_1Tg.a7eAIhcdwrRAuLVEbHsSbclmlpQ
    at RequestHandler.execute (f:\Selfbot\node_modules\discord.js-selfbot-v13\src\rest\RequestHandler.js:415:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async RequestHandler.push (f:\Selfbot\node_modules\discord.js-selfbot-v13\src\rest\RequestHandler.js:63:14)
    at async f:\Selfbot\auth.js:9:5 {
  method: 'post',
  path: '/oauth2/authorize?client_id=1232384723188449283&integration_type=0&scope=bot+applications.commands',
  code: undefined,
  httpStatus: 400,
  requestData: {
    json: {
      guild_id: '1308779851146334229',
      authorize: true,
      permissions: '8'
    },
    files: [],
    headers: undefined
  },
  retries: 0,
  captcha: {
    captcha_key: [ 'captcha-required' ],
    captcha_sitekey: 'a9b5fb07-92ff-493f-86fe-352a2803b3df',
    captcha_service: 'hcaptcha',
    captcha_rqdata: 'qoTfRdXWuwV/0ZBcmkHUHVOrkBDbyyVKmR0Tug/dXVH1Xf1Bocl26bODUPMq72k/pcdeWGF640kvSM7E1vo1WCFfEPdMJeio1k8j6DzCiLtuROUF2r0h+ZlcRchZuyIE',
    captcha_rqtoken: 'ImFZT3lZaWVtdTU4b0sxVXFrekkzN3JKT1pVYVlvaVpWOUk5YjQ3ZmxES0xKT1J0R2g1OEFYV3VTV2JVd0VuNnlxWk85eFE9PUZkMTVyTStSTXcrbDdmNjci.Zz_1Tg.a7eAIhcdwrRAuLVEbHsSbclmlpQ'
  }
}

Node.js v22.11.0


### Package version

3.1.4

### Node.js version

22.11.0

### Operating system

windows 10

### Priority this issue should have

Low (slightly annoying)

### Checklist

- [X] I have searched the open issues for duplicates.
- [X] I have shared the entire traceback.
- [X] I am using a user token (and it isn't visible in the code).

### Additional Information

_No response_
TheDevYellowy commented 11 hours ago

You have to add the captcha solver like in examples/AddBot.js, it's built this way so that people can make their own solvers or use others that may not be supported if we hardcode the solvers