Discord.py Reaction bot that gives a role

2019-05-23 14:58发布

问题:

How do I make a bot that would give people roles when they reacted to a specific thing? So far I have this but it does not work

@client.event
async def on_ready():
    channel = client.get_channel('513546504481406979')
    role = discord.utils.get(user.server.roles, name="testrole")
    message = await bot.send_message(channel, "React to me!")
    while True:
        reaction = await bot.wait_for_reaction(emoji="