Home>

There is a bot, it has all the rights from discord.api to server rights. When I try to portray the role, he writes that there are no rights, but they are. What is the problem?

Traceback (most recent call last):
  File "C: \ Users \ c_210 \ AppData \ Local \ Programs \ Python \ Python39 \ lib \ site-packages \ discord \ client.py", line 343, in _run_event
    await coro (* args, ** kwargs)
  File "D: \ projects \ python \ BOT LEHA \ main.py", line 47, in on_button_click
    await member.add_roles (role)
  File "C: \ Users \ c_210 \ AppData \ Local \ Programs \ Python \ Python39 \ lib \ site-packages \ discord \ member.py", line 777, in add_roles
    await req (guild_id, user_id, role.id, reason= reason)
  File "C: \ Users \ c_210 \ AppData \ Local \ Programs \ Python \ Python39 \ lib \ site-packages \ discord \ http.py", line 248, in request
    raise Forbidden (r, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions

---code ---

async def on_button_click (interaction):
    guild= bot.get_guild (interaction.guild.id)
    if interaction.component.id== "getrole":
            member= interaction.author
            role= discord.utils.get (member.guild.roles, id= 861376131512795158)
            channel= bot.get_channel (903195927819468820)
            #Role= guild.get_role (861376131512795158)
            if not role in member.roles:
                role= discord.utils.get (member.guild.roles, id= 861376131512795158)
                await member.add_roles (role)
                await interaction.respond (content= "Welcome!")
                await channel.send (f "{member} got role ???????????????? -???????????? ™")
            else:
                await interaction.respond (content= "You alredy in our team!") `` '

show the list of server roles and bot roles

alex2021-11-17 08:50:42
  • Answer # 1

    The role had to be put above all)

    please try to leave a little more detailed answers. you can complete the answer by clicking edit

    aleksandr barakin2021-11-17 11:50:46
  • Answer # 2

    The role had to be put above all)

    please try to leave a little more detailed answers. you can complete the answer by clicking edit

    aleksandr barakin2021-11-17 11:50:46