Skip to content
This repository was archived by the owner on Oct 11, 2025. It is now read-only.
This repository was archived by the owner on Oct 11, 2025. It is now read-only.

Error adding a bot problem #1733

@vrtlol

Description

@vrtlol

Which package has the bugs?

The core library

Issue description

ERROR_METHOD_CALL
Failed to add bot to server: xxxx. Error: An Unexpected Error has occured. Please submit an issue on GitHub detailing this event.

it happens when u try and invite a bot to a server, was working fine a few days ago until recently.

Code sample

'use strict';

const Captcha = require('2captcha');
const Discord = require('../src/index');

const solver = new Captcha.Solver('<2captcha key>');

const client = new Discord.Client({
  captchaSolver: function (captcha, UA) {
    return solver
      .hcaptcha(captcha.captcha_sitekey, 'discord.com', {
        invisible: 1,
        userAgent: UA,
        data: captcha.captcha_rqdata,
      })
      .then(res => res.data);
  },
  TOTPKey: '<string>',
});

client.on('ready', async () => {
  console.log('Ready!', client.user.tag);
  // Note
  // You need to include `guild_id` to invite the bot
  // These two fields can appear either in the URL or in the options.
  await client.authorizeURL(
    `https://discord.com/api/oauth2/authorize?client_id=289066747443675143&permissions=414501424448&scope=bot%20applications.commands`,
    {
      guild_id: 'guild id',
    },
  );
});

client.login('token');

Package version

3.7.0

Node.js version

22.17.1

Operating system

w11

Priority this issue should have

Medium (should be fixed soon)

Checklist

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

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions