For some reason I keep getting a permissions error (see at bottom). Whenever I try to remove the reaction, which will remove the associated role, the permissions error occurs. This is odd, because I tripple checked that my bot role is both admin and the highest in the role list. In my bot, on_raw_reaction_add() works perfectly fine so, I have permission to add a role but not remove it?
Additionally, in my on_message() block, I have other functions that removes roles, too. So, I don't really think there is a lack of permission unless I'm doing something behind the scenes that I don't know about? Here is my code:
@client.event
async def on_raw_reaction_remove(payload):
react_msg = message_id
guild = client.get_guild(guild_id)
if int(payload.message_id) == react_msg:
member = await client.guilds[0].fetch_member(payload.user_id)
if str(payload.emoji.name) == "\U0001f534":
role = discord.utils.get(guild.roles, name = "Red")
elif str(payload.emoji.name) == "\U0001f535":
role = discord.utils.get(guild.roles, name = "Blue")
elif str(payload.emoji.name) == "\U0001f7e2":
role = discord.utils.get(guild.roles, name = "Green")
elif str(payload.emoji.name) == "\U0001f7e1":
role = discord.utils.get(guild.roles, name = "Yellow")
elif str(payload.emoji.name) == "\U0001f7e0":
role = discord.utils.get(guild.roles, name = "Orange")
elif str(payload.emoji.name) == "\U0001f7e3":
role = discord.utils.get(guild.roles, name = "Purple")
await member.remove_roles(role)
Once removing my reaction, I get:
discord.errors.Forbidden: 403 Forbidden (error code: 50001): Missing Access