user15238078
user15238078

Reputation:

Self bot join server (discord,py)

Im trying to make my self bot join a server. I know that self bots are against Discord TOS but I want to learn something new.

This is the command I tried:

@client.command()
async def join(serverlink):
    await client.accept_invite(serverlink)

Error:

File "bot.py", line 6821, in join
await client.accept_invite(serverlink)
AttributeError: 'Bot' object has no attribute 'accept_invite'

Upvotes: 1

Views: 4461

Answers (2)

Spider-Man
Spider-Man

Reputation: 50

Late to answer, but in case anyone still needs it, leaving this here.

Considering it's an self bot, you can use discord's user endpoint to make it join the server, which is https://discord.com/api/v9/invites/{invite_code} where the invite_code is the code to your server.

So the code would be something like:

import requests
#base url
url = "https://discord.com/api/v9/invites/{}"
#headers, add more headers to make sure you dont get banned by discord for automating, you can see your headers by pressing ctrl+shift+i and going to the networks tab.
headers = {
    "Authorization":"your token here"
}

r = requests.post(url.format("your invite code"), headers=headers, json={})
print(r.status_code) #prints 200 if all went well

Remember this goes against ToS, so first testing it on an alt account seems like a good idea.

Upvotes: 2

JackTheWebDev
JackTheWebDev

Reputation: 1

Discord bots currently have no way to join servers by themselves, they can only be invited to servers by being manually invited by a user with the "Manage server" permissions.

Upvotes: 0

Related Questions