diff options
author | 2019-11-15 01:02:40 +0100 | |
---|---|---|
committer | 2019-11-15 01:02:40 +0100 | |
commit | 8c64fc637dda73cfa4b79d1f3541d067380e51d8 (patch) | |
tree | 8cd71aa9147f0ddd911d941607d301a1e4caa700 | |
parent | Add MockAttachment type and attachments default for MockMessage (diff) |
Check only for bot's green checkmark in DuckPond
Previously, the presence of any green checkmark as a reaction would
prevent a message from being relayed to the duck pond, regardless of
the actor of that reaction. Since we only want to check if the bot
has already processed this message, we should check for a checkmark
added by the bot.
This commit adds such a user check.
-rw-r--r-- | bot/cogs/duck_pond.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/bot/cogs/duck_pond.py b/bot/cogs/duck_pond.py index 45bbc410b..aac023a2e 100644 --- a/bot/cogs/duck_pond.py +++ b/bot/cogs/duck_pond.py @@ -37,12 +37,13 @@ class DuckPond(Cog): return True return False - @staticmethod - def has_green_checkmark(message: Message) -> bool: + async def has_green_checkmark(self, message: Message) -> bool: """Check if the message has a green checkmark reaction.""" for reaction in message.reactions: if reaction.emoji == "✅": - return True + async for user in reaction.users(): + if user == self.bot.user: + return True return False async def send_webhook( @@ -115,7 +116,7 @@ class DuckPond(Cog): return # Does the message already have a green checkmark? - if self.has_green_checkmark(message): + if await self.has_green_checkmark(message): return # Time to count our ducks! |