diff options
| author | 2020-09-30 16:11:00 -0700 | |
|---|---|---|
| committer | 2020-09-30 16:11:00 -0700 | |
| commit | fc0da38b15ce01f90219346cf6fc0cfec592c682 (patch) | |
| tree | fcbb54bbad2592564c602e2096b559171805638a | |
| parent | PR #1191 Verification: broaden 50_007 error handling (diff) | |
Catch 404 in wait_for_deletion when reacting
The message may be deleted before the bot gets a chance to react.
Fixes #1181
| -rw-r--r-- | bot/utils/messages.py | 6 | 
1 files changed, 5 insertions, 1 deletions
| diff --git a/bot/utils/messages.py b/bot/utils/messages.py index 9cc0d8a34..d0b2342b3 100644 --- a/bot/utils/messages.py +++ b/bot/utils/messages.py @@ -34,7 +34,11 @@ async def wait_for_deletion(      if attach_emojis:          for emoji in deletion_emojis: -            await message.add_reaction(emoji) +            try: +                await message.add_reaction(emoji) +            except discord.NotFound: +                log.trace(f"Aborting wait_for_deletion: message {message.id} deleted prematurely.") +                return      def check(reaction: discord.Reaction, user: discord.Member) -> bool:          """Check that the deletion emoji is reacted by the appropriate user.""" | 
