'role react bot discord python

I'm trying to create a react role on a message that my bot would have sent, how can I do it? here is my code debut:

@bot.command(name = 'role_react_1')
async def role_react_1(ctx):
        del = await ctx.channel.history(limit=1).flatten()
    for each_messages in del:
        await each_messages.delete()
    message = await ctx.send("for have the role : evil : :smiling_imp: \nwhat role you want ?")
    await message.add_reaction("????")

    def checkEmoji(reaction):
        return message.id == reaction.message.id and str(reaction.emoji) == ":evil:"

    reaction = await bot.wait_for("reaction_add", check=checkEmoji)

    if reaction.emoji == ":evil:":
        role = discord.utils.get(ctx.guild.roles, name="evil")
        await ctx.author.add_roles(role)
        await ctx.send(f"the role {role} was assigned")

I've been told about 'on_raw_reaction_add' but I don't know how to use it. how to do it



Solution 1:[1]

if someone want a answer, it need a bot.event with reaction_add

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 hp fort