From 709da02ffedf388a739f24602f7b300c28043bfa Mon Sep 17 00:00:00 2001 From: Myned Date: Sun, 31 Dec 2017 21:56:01 -0500 Subject: [PATCH] Moved sleep and message deletion to trigger on successful reverse --- src/cogs/booru.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/cogs/booru.py b/src/cogs/booru.py index cb5dcf8..f6b3192 100644 --- a/src/cogs/booru.py +++ b/src/cogs/booru.py @@ -566,18 +566,20 @@ class MsG: await message.add_reaction('\N{WHITE HEAVY CHECK MARK}') + await asyncio.sleep(self.RATE_LIMIT) + + with suppress(err.NotFound): + await message.delete() + except exc.MatchError as e: await message.channel.send('**No probable match for:** `{}`'.format(e), delete_after=7) await message.add_reaction('\N{CROSS MARK}') except exc.SizeError as e: await message.channel.send(f'`{e}` **too large.** Maximum is 8 MB', delete_after=7) await message.add_reaction('\N{CROSS MARK}') - - finally: - await asyncio.sleep(self.RATE_LIMIT) - - with suppress(err.NotFound): - await message.delete() + except Exception: + await message.channel.send(f'**An unknown error occurred.**', delete_after=7) + await message.add_reaction('\N{WARNING SIGN}') print('STOPPED : reversifying')