From 30d558177ebd7eaf938653669e17e34932c056de Mon Sep 17 00:00:00 2001 From: Myned Date: Thu, 19 Oct 2017 12:42:19 -0400 Subject: [PATCH] Reaction order tweak --- src/main/cogs/booru.py | 52 +++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/src/main/cogs/booru.py b/src/main/cogs/booru.py index c4c4560..e91c96c 100644 --- a/src/main/cogs/booru.py +++ b/src/main/cogs/booru.py @@ -498,10 +498,10 @@ class MsG: raise exc.GoTo elif reaction.emoji == '\N{LEFTWARDS BLACK ARROW}' and reaction.message.id == paginator.id and (user is ctx.author or user.id == u.config['owner_id']): raise exc.Left - elif reaction.emoji == '\N{BLACK RIGHTWARDS ARROW}' and reaction.message.id == paginator.id and (user is ctx.author or user.id == u.config['owner_id']): - raise exc.Right elif reaction.emoji == '\N{GROWING HEART}' and reaction.message.id == paginator.id and (user is ctx.author or user.id == u.config['owner_id']): raise exc.Save + elif reaction.emoji == '\N{BLACK RIGHTWARDS ARROW}' and reaction.message.id == paginator.id and (user is ctx.author or user.id == u.config['owner_id']): + raise exc.Right return False def on_message(msg): @@ -531,7 +531,7 @@ class MsG: paginator = await dest.send(embed=embed) - for emoji in ('\N{NUMBER SIGN}\N{COMBINING ENCLOSING KEYCAP}', '\N{LEFTWARDS BLACK ARROW}', '\N{BLACK RIGHTWARDS ARROW}', '\N{GROWING HEART}'): + for emoji in ('\N{NUMBER SIGN}\N{COMBINING ENCLOSING KEYCAP}', '\N{LEFTWARDS BLACK ARROW}', '\N{GROWING HEART}', '\N{BLACK RIGHTWARDS ARROW}'): await paginator.add_reaction(emoji) await ctx.message.add_reaction('\N{OCTAGONAL SIGN}') await asyncio.sleep(1) @@ -570,6 +570,16 @@ class MsG: else: await paginator.edit(content='**First image.**') + except exc.Save: + if values[c - 1]['url'] not in starred: + starred.append(values[c - 1]['url']) + + await paginator.edit(content='\N{HEAVY BLACK HEART}') + else: + starred.remove(values[c - 1]['url']) + + await paginator.edit(content='\N{BROKEN HEART}') + except exc.Right: if c < len(keys): c += 1 @@ -581,16 +591,6 @@ class MsG: await paginator.edit(content='\N{HEAVY BLACK HEART}' if values[c - 1]['url'] in starred else None, embed=embed) - except exc.Save: - if values[c - 1]['url'] not in starred: - starred.append(values[c - 1]['url']) - - await paginator.edit(content='\N{HEAVY BLACK HEART}') - else: - starred.remove(values[c - 1]['url']) - - await paginator.edit(content='\N{BROKEN HEART}') - except exc.Abort: try: await paginator.edit(content='**Exited paginator.**') @@ -683,10 +683,10 @@ class MsG: raise exc.GoTo elif reaction.emoji == '\N{LEFTWARDS BLACK ARROW}' and reaction.message.id == paginator.id and (user is ctx.author or user.id == u.config['owner_id']): raise exc.Left - elif reaction.emoji == '\N{BLACK RIGHTWARDS ARROW}' and reaction.message.id == paginator.id and (user is ctx.author or user.id == u.config['owner_id']): - raise exc.Right elif reaction.emoji == '\N{GROWING HEART}' and reaction.message.id == paginator.id and (user is ctx.author or user.id == u.config['owner_id']): raise exc.Save + elif reaction.emoji == '\N{BLACK RIGHTWARDS ARROW}' and reaction.message.id == paginator.id and (user is ctx.author or user.id == u.config['owner_id']): + raise exc.Right return False def on_message(msg): @@ -719,7 +719,7 @@ class MsG: paginator = await dest.send(embed=embed) - for emoji in ('\N{NUMBER SIGN}\N{COMBINING ENCLOSING KEYCAP}', '\N{LEFTWARDS BLACK ARROW}', '\N{BLACK RIGHTWARDS ARROW}', '\N{GROWING HEART}'): + for emoji in ('\N{NUMBER SIGN}\N{COMBINING ENCLOSING KEYCAP}', '\N{LEFTWARDS BLACK ARROW}', '\N{GROWING HEART}', '\N{BLACK RIGHTWARDS ARROW}'): await paginator.add_reaction(emoji) await ctx.message.add_reaction('\N{OCTAGONAL SIGN}') await asyncio.sleep(1) @@ -757,6 +757,16 @@ class MsG: else: await paginator.edit(content='**First image.**') + except exc.Save: + if values[c - 1]['url'] not in starred: + starred.append(values[c - 1]['url']) + + await paginator.edit(content='\N{HEAVY BLACK HEART}') + else: + starred.remove(values[c - 1]['url']) + + await paginator.edit(content='\N{BROKEN HEART}') + except exc.Right: if c % limit == 0: await dest.trigger_typing() @@ -777,16 +787,6 @@ class MsG: embed.set_image(url=values[c - 1]['url']) await paginator.edit(content='\N{HEAVY BLACK HEART}' if values[c - 1]['url'] in starred else None, embed=embed) - except exc.Save: - if values[c - 1]['url'] not in starred: - starred.append(values[c - 1]['url']) - - await paginator.edit(content='\N{HEAVY BLACK HEART}') - else: - starred.remove(values[c - 1]['url']) - - await paginator.edit(content='\N{BROKEN HEART}') - except exc.Abort: try: await paginator.edit(content='**Exited paginator.**')