0

So I want to make a text game that edits the character every time the author who called the command reacts. My code so far for adding reactions:

@client.command()
async def test(ctx):
    msg = await ctx.send('Hi')
    up = '⬆'
    down = '⬇'
    left = '⬅'
    right = '➡'
    await msg.add_reaction(up)
    await msg.add_reaction(down)
    await msg.add_reaction(left)
    await msg.add_reaction(right)

This adds the up arrow, down arrow, left arrow, and right arrow to the message "Hi". I want to see if someone clicked on the arrow and if that someone is the author of the command. I have no idea how to get if the author of the command clicked on the arrow reaction. Any help would be appreciated.

1 Answers1

1

If you're waiting for a reaction, use wait_for() with the reaction_add event as the positional argument.

To limit it to the invoker, you can create a check and pass it into the check kwarg of wait_for(). The check would take in two arguments and you only need to compare if ctx.author is the same as the check author.

There is an example for wait_for() in the documentation

References: https://discordpy.readthedocs.io/en/latest/ext/commands/api.html?highlight=wait_for#discord.ext.commands.Bot.wait_for

CubeBlazer
  • 114
  • 4