E
E
Egor Knyazev2021-05-16 13:10:28
Python
Egor Knyazev, 2021-05-16 13:10:28

The bot does not issue a role when clicking on the reaction, there are no errors, how to fix it?

Good day, the message is created and the reaction is added, but when you click on it, the role is not issued.
The code:

@commands.command(aliases = ["меропртиятие"])
@commands.has_permissions(administrator=True)
async def mp(self, ctx):
    emb = discord.Embed(title=f'Праздник ', description='Нажми на реакцию что бы получить роль',
                        colour=discord.Color.purple())

    message = await ctx.send(embed=emb)  
    await message.add_reaction('✅') 

    roles = discord.utils.get(message.guild.roles, id=839599224000610344) 

    check = lambda reaction, user: client.user != user 

    while True:
        reaction, user = await client.wait_for('reaction_add', check=check) 
        if str(reaction.emoji) == "✅":
            await user.add_roles(roles) 
            print('[SUCCESS] Пользователь {0.display_name} получил новую роль {1.name}'.format(user, roles)) 

            await user.send('TEST')

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question