K
K
Korlara2021-06-21 16:37:02
Python
Korlara, 2021-06-21 16:37:02

Where is the error in the code?

I made a code how to solve the error

@Bot.event
async def on_raw_reaction_remove(payload):
    channel = Bot.get_channel(payload.channel_id)
    message = await channel.fetch_message(payload.message_id)
    guild = Bot.get_guild(payload.guild_id)
    reaction = discord.utils.get(message.reactions, emoji=payload.emoji.name)
    payload.member = guild.get_member(payload.member)


    if payload.message_id == здесь ид and reaction.emoji == 'здесь emoji':
        role = discord.utils.get(guild.roles, name='здесь роль')
        await payload.member.remove_role(role)

This code was created so that when a person took the role from the message, he was removed from the role, and so it gives an error:
60d0958d552df227083414.png
I also want to ask, can I do the same only with animated emoji on the message, can I just insert the name of the emoji into reaction.emoji == 'emoji name'?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stefan, 2021-06-21
@MEDIOFF

await payload.member.remove_role(role)
Here is the error

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question