0

I am trying to make a post request to the following endpoint:

`https://discord.com/api/v9/invites/${link}`

But, i keep getting the following response:

{
  captcha_key: [ 'captcha-required' ],
  captcha_sitekey: '4c672d35-0701-42b2-88c3-78380b0db560',
  captcha_service: 'hcaptcha'
}

What i am trying to do is to write a script where i can join a discord server from a provided discord server invite link.

Below is the function I am using to make a request.

const fetch_request = async (link, options) => {
  if (typeof link !== "string") throw new Error("Couldn't fetch");
  return new Promise((res, rej) => {
      fetch(`https://discord.com/api/v9/invites/${link}`, {
          headers: {
              "accept": "*/*",
              "accept-language": "en-US",
              "authorization": "<user_token_here>",
              "content-type": "application/json",
              "sec-fetch-dest": "empty",
              "sec-fetch-mode": "cors",
              "sec-fetch-site": "same-origin",
              "x-discord-locale": "en-US",
              "origin": "https://discord.com",
              referer: `https://discord.com/channels/@me`,
              mode: "cors",
          },
          body: JSON.stringify('{}'),
          method: 'POST'
              
        }).then((response) => {
          if (options.parse) {
              response.json().then((m) => {
                  res(m);
              });
          } else {
              res(response);
          }
      });
  });
}

The request seems to be made but, how do I bypass this capctha. I checked headers, they seem to be ok to me. How do I get the user to join a guild using discord api?

Thank you for help.

3
  • Are You trying to do a self-bot? This is against the Discord ToS. This is probably a protection against raiding servers with bot accounts.
    – Piecuu
    Commented Feb 9, 2022 at 11:45
  • @Min3craftPolska This is not a self-bot. I know TOS and I am aware of all the risks I am taking by doing this. I am logging in to my personal account using discord and I want to automate a script where I can join servers whenever someone dm me a server. Is there a way to bypass this protection? How can i bypass this captcha? Commented Feb 9, 2022 at 12:24
  • That's not possible then.
    – Piecuu
    Commented Feb 10, 2022 at 13:52

2 Answers 2

1

You need to solve the captchas, i suggest you solving them with a service like 2captchas or other similar options, they are super cheap and usually don't take too long to setup.

3
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Mar 8, 2022 at 1:32
  • @Flavio Lugli, I can solve the captcha using captcha solving services and i do get the key that is received after solving the captcha but, After solving the captcha, what am i supposed to do with that solved captcha as discord api to join a guild does not take any body in a request. Commented Mar 8, 2022 at 17:39
  • it requires the captcha key in the payload if you check your network traffic while joining a server, you should pass it as "captcha_key" Commented Mar 10, 2022 at 20:33
0

I was just trying the same thing as you, check out 2Captcha's API .

It's very cheap, all you need is to get "captcha_key" and add it to your request next time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.