'How to join guilds automatically with discord.py?

I've been working on a selfbot with discord.py for a while. I know it's against the ToS and everything. I've come across an issue of getting whoever runs the selfbot to automatically join a specific server. I've been trying different things for several hours and keep getting a 404 error after looking at older methods of accomplishing this.

This is my current code:

@self.event
async def on_ready():
  print("ready")
  req = requests.post('https://discord.com/api/v9/invite/q2233fN',{'Authorization':token2})
  print("running")
  print(req.status_code)

The output is:

ready running 404

I'm assuming something is wrong with the api link I'm using. Any ideas?



Solution 1:[1]

404 - not found The Invitelink or the api endpoint isn't correct. maybe you can try to manually join the server within a browser while having devconsole & networkin tab open. This allow you to inspect requests being made when joining and which data is sent etc. you then can implement this logic within your python code.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Toastlover