From f06f743179ce59edc4534f1f2386e9ce1db7201f Mon Sep 17 00:00:00 2001 From: Dylan Dizon Date: Thu, 8 Nov 2018 22:31:45 -0500 Subject: [PATCH 1/3] Remove unnecessary while loop --- src/cogs/booru.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/cogs/booru.py b/src/cogs/booru.py index 93366c0..ecc04b3 100644 --- a/src/cogs/booru.py +++ b/src/cogs/booru.py @@ -1507,9 +1507,7 @@ class MsG: pass await message.edit(content=f'Confirm or deny changes') - - while not self.bot.is_closed: - await self.bot.wait_for('reaction_add', check=on_reaction, timeout=8 * 60) + await self.bot.wait_for('reaction_add', check=on_reaction, timeout=8 * 60) self.aliases.update(aliases) u.dump(self.aliases, 'cogs/aliases.pkl') From b978148e0f74a85b53751663a9cf0cea90e40209 Mon Sep 17 00:00:00 2001 From: Dylan Dizon Date: Thu, 8 Nov 2018 22:32:04 -0500 Subject: [PATCH 2/3] Add suppressing of NotFound errors while deleting messages --- src/cogs/booru.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/cogs/booru.py b/src/cogs/booru.py index ecc04b3..0542299 100644 --- a/src/cogs/booru.py +++ b/src/cogs/booru.py @@ -1524,9 +1524,10 @@ class MsG: finally: if messages: - for msg in messages: - await msg.delete() - await message.delete() + with suppress(err.NotFound): + for msg in messages: + await msg.delete() + await message.delete() @_add_tags.command(name='global', aliases=['gl', 'g']) @cmds.is_owner() From b099084571f72f6549fb09b4d23f1a1da6ea38b1 Mon Sep 17 00:00:00 2001 From: Dylan Dizon Date: Thu, 8 Nov 2018 22:32:46 -0500 Subject: [PATCH 3/3] Change terminology to reflect actual command flow --- src/cogs/booru.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cogs/booru.py b/src/cogs/booru.py index 0542299..45a2e0f 100644 --- a/src/cogs/booru.py +++ b/src/cogs/booru.py @@ -1490,7 +1490,7 @@ class MsG: await self.bot.wait_for('reaction_add', check=on_reaction, timeout=8 * 60) except exc.Remove: - await message.edit(content=f'Type the tag(s) to remove or `0` to cancel:') + await message.edit(content=f'Type the tag(s) to remove or `0` to continue:') try: while not self.bot.is_closed():