Most of this is fine, but how do I make it only edit the most recent message that the user has sent? If someone types the same command twice, then reacts on the 2nd message, it will edit both messages as long as it's in the 60 second window before it times out. Here is the code:
px = await ctx.send(embed=e)
for name in reactions:
emoji = get(ctx.guild.emojis, name=name)
try: await px.add_reaction(emoji or name)
except: return
def check(reaction, user):
return user == ctx.author and str(reaction.emoji) in reactions
while True:
try:
reaction, user = await self.bot.wait_for("reaction_add", timeout=60, check=check)
if str(reaction.emoji) == "right":
p += 1
# doing the command again but + 1 page
await px.edit(embed=e)
elif str(reaction.emoji) == "left":
p -= 1
# doing the command again but - 1 page
await px.edit(embed=e)
else:
await px.remove_reaction(reaction, user)
except asyncio.TimeoutError:
break
I only want it to edit the most recent use of the command from that user. Thanks.