ArkHiMed-tech2022-01-16 17:45:20
ArkHiMed-tech, 2022-01-16 17:45:20

403 Forbidden when trying to give out a role in discord.py?

I have code:

intents = discord.Intents.all()
bot = commands.Bot(command_prefix = settings['prefix'], intents=intents)

async def on_member_join(member):
    await member.send(f"Thanks for Joining {member.guild.name}")
    role = discord.utils.get(member.guild.roles, id=123456)
    await member.add_roles(role)

And where I try to issue a role, it gives out "discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions", although I allowed him absolutely everything (from the administrator on the server to the line "intents = discord.Intents .all()"

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Alexander, 2022-01-16

depending on what role you want to issue.
for example, if a bot has the "Admin" role, with all rights (including administrator rights), it will not be able to:
1) give someone the Admin role, remove the Admin role from itself.
2) give someone a role that is higher in the list of roles than Admin.
only the owner of the server can manipulate absolutely all roles.

soremix, 2022-01-16

In theory, administrator rights prevent bots from interacting with people who have a higher role. Also, most likely you are trying to give a person a role that is more privileged than the role of a bot. In general, the role of a bot should be above others.
People also say that the problem can be if 2FA is enabled on the server, in which case the bot owner should also enable it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question