If you DM the bot it will send a message and add some reactions, it then waits for the user to add reaction before doing something.
My problem is if the user DMs the bot again, it will send another message and if the user reacts to any of the bot messages, bot will do the things twice or more depending on how many messages you got from the bot.
Is there a way to make the bot to not send another message if there's a current message with reaction and wait for the user to react first before the bot can send another message with reaction again? Thanks.
async def on_message(self, message):
if message.author.bot:
return
if isinstance(message.channel, discord.DMChannel):
dm = await message.channel.send('test')
await dm.add_reaction("1️⃣")
def check(reaction, user):
return user == message.author and str(reaction.emoji) in ["1️⃣"]
while True:
try:
reaction, user = await self.client.wait_for("reaction_add", timeout=15, check=check)
if str(reaction.emoji) == "1️⃣":
# do something here
except asyncio.TimeoutError:
await dm.delete()
break