'Discord bot's own reactions trigger wait_for

I'm struck with a weird problem, here is the code :

                embed_msg = await ctx.channel.send(embed=embed)
                await embed_msg.add_reaction('👍')
                await embed_msg.add_reaction('👎')
                reaction, user = await self.bot.wait_for('reaction_add')
                if str(reaction.emoji) == '👍':
                     print('GOOD ! ')
                elif str(reaction.emoji) == '👎':
                     print('BAD !')
                     return

Problem is, when I start the bot and I try this, there's a 1/10 chance that this will work but 9/10 that the 'BAD !' condition trigger itself. I have no clues what to do about that

Thanks for the help



Solution 1:[1]

Assuming that self.bot.wait_for returns a user object, you can check if the reaction was added by a bot or not. Because the bot may be reacting to its own message. This will not work if it is not a user object. Sorry if I messed up the indentation.

embed_msg = await ctx.channel.send(embed=embed)
await embed_msg.add_reaction('?')
await embed_msg.add_reaction('?')
reaction, user = await self.bot.wait_for('reaction_add')
if str(reaction.emoji) == '?':
    if not user.bot:
        print('GOOD ! ')
elif str(reaction.emoji) == '?':
    if not user.bot:
        print('BAD !')
        return

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Yurata