From 7a6ea6907f220fc4016cef55212e4d6b0e26cedc Mon Sep 17 00:00:00 2001 From: Myned Date: Wed, 8 Nov 2017 23:47:51 -0500 Subject: [PATCH 1/4] Added "als" alias for aliases command --- src/main/cogs/booru.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/cogs/booru.py b/src/main/cogs/booru.py index 7040299..75dd812 100644 --- a/src/main/cogs/booru.py +++ b/src/main/cogs/booru.py @@ -88,7 +88,7 @@ class MsG: await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}') # Tag aliases - @commands.command(name='aliases', aliases=['alias'], brief='e621 Tag aliases', description='e621 | NSFW\nSearch aliases for given tag') + @commands.command(name='aliases', aliases=['alias', 'als'], brief='e621 Tag aliases', description='e621 | NSFW\nSearch aliases for given tag') @checks.del_ctx() async def tag_aliases(self, ctx, *args): kwargs = u.get_kwargs(ctx, args) From 8e9c37b0925c385a80ca8821df6c2e3424e2cf79 Mon Sep 17 00:00:00 2001 From: Myned Date: Wed, 8 Nov 2017 23:48:12 -0500 Subject: [PATCH 2/4] Compressed temp blacklist creation --- src/main/cogs/booru.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main/cogs/booru.py b/src/main/cogs/booru.py index 75dd812..ba30ab2 100644 --- a/src/main/cogs/booru.py +++ b/src/main/cogs/booru.py @@ -568,12 +568,9 @@ class MsG: blacklist = set() # Creates temp blacklist based on context - for tag in self.blacklists['global_blacklist']: - blacklist.update(list(self.aliases[tag]) + [tag]) - for tag in self.blacklists['guild_blacklist'].get(guild.id, {}).get(ctx.channel.id, set()): - blacklist.update(list(self.aliases[tag]) + [tag]) - for tag in self.blacklists['user_blacklist'].get(ctx.author.id, set()): - blacklist.update(list(self.aliases[tag]) + [tag]) + for bl in (self.blacklists['global_blacklist'], self.blacklists['guild_blacklist'].get(guild.id, {}).get(ctx.channel.id, set()), self.blacklists['user_blacklist'].get(ctx.author.id, set())): + for tag in bl: + blacklist.update([tag] + list(self.aliases[tag])) # Checks for, assigns, and removes first order in tags if possible order = [tag for tag in tags if 'order:' in tag] if order: From f68115901bb4ba23da3c6a14cf26de4de709506c Mon Sep 17 00:00:00 2001 From: Myned Date: Wed, 8 Nov 2017 23:48:46 -0500 Subject: [PATCH 3/4] Fixed tags not appearing in error output when internal timeout activates --- src/main/cogs/booru.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/cogs/booru.py b/src/main/cogs/booru.py index ba30ab2..94ce86b 100644 --- a/src/main/cogs/booru.py +++ b/src/main/cogs/booru.py @@ -627,7 +627,7 @@ class MsG: if posts: return posts, order else: - raise exc.NotFound + raise exc.NotFound(formatter.tostring(tags)) # Creates reaction-based paginator for linked pools @commands.command(name='poolpage', aliases=['poolp', 'pp', 'e621pp', 'e6pp', '6pp'], brief='e621 pool paginator', description='e621 | NSFW\nShow pools in a page format') From 852fe6b5a76252c629d9fdb578c2b6602428da4e Mon Sep 17 00:00:00 2001 From: Myned Date: Wed, 8 Nov 2017 23:49:12 -0500 Subject: [PATCH 4/4] Lowered 10 min timeout for paginators to 7 mins --- src/main/cogs/booru.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/cogs/booru.py b/src/main/cogs/booru.py index 94ce86b..9eb1cf0 100644 --- a/src/main/cogs/booru.py +++ b/src/main/cogs/booru.py @@ -678,8 +678,8 @@ class MsG: while not self.bot.is_closed(): try: - await asyncio.gather(*[self.bot.wait_for('reaction_add', check=on_reaction, timeout=10 * 60), - self.bot.wait_for('reaction_remove', check=on_reaction, timeout=10 * 60)]) + await asyncio.gather(*[self.bot.wait_for('reaction_add', check=on_reaction, timeout=7 * 60), + self.bot.wait_for('reaction_remove', check=on_reaction, timeout=7 * 60)]) except exc.Save: if values[c - 1]['url'] not in hearted: @@ -706,7 +706,7 @@ class MsG: except exc.GoTo: await paginator.edit(content='**Enter image number...**') - number = await self.bot.wait_for('message', check=on_message, timeout=10 * 60) + number = await self.bot.wait_for('message', check=on_message, timeout=7 * 60) c = int(number.content) await number.delete() @@ -819,8 +819,8 @@ class MsG: while not self.bot.is_closed(): try: - await asyncio.gather(*[self.bot.wait_for('reaction_add', check=on_reaction, timeout=10 * 60), - self.bot.wait_for('reaction_remove', check=on_reaction, timeout=10 * 60)]) + await asyncio.gather(*[self.bot.wait_for('reaction_add', check=on_reaction, timeout=7 * 60), + self.bot.wait_for('reaction_remove', check=on_reaction, timeout=7 * 60)]) except exc.Save: if values[c - 1]['url'] not in hearted: @@ -847,7 +847,7 @@ class MsG: except exc.GoTo: await paginator.edit(content='**Enter image number...**') - number = await self.bot.wait_for('message', check=on_message, timeout=10 * 60) + number = await self.bot.wait_for('message', check=on_message, timeout=7 * 60) c = int(number.content) await number.delete() @@ -984,8 +984,8 @@ class MsG: while not self.bot.is_closed(): try: - await asyncio.gather(*[self.bot.wait_for('reaction_add', check=on_reaction, timeout=10 * 60), - self.bot.wait_for('reaction_remove', check=on_reaction, timeout=10 * 60)]) + await asyncio.gather(*[self.bot.wait_for('reaction_add', check=on_reaction, timeout=7 * 60), + self.bot.wait_for('reaction_remove', check=on_reaction, timeout=7 * 60)]) except exc.Save: if values[c - 1]['url'] not in hearted: @@ -1012,7 +1012,7 @@ class MsG: except exc.GoTo: await paginator.edit(content='**Enter image number...**') - number = await self.bot.wait_for('message', check=on_message, timeout=10 * 60) + number = await self.bot.wait_for('message', check=on_message, timeout=7 * 60) c = int(number.content) await number.delete()