1
0
Fork 0
mirror of https://github.com/myned/modufur.git synced 2024-12-25 06:37:29 +00:00

Reaction order tweak

This commit is contained in:
Myned 2017-10-19 12:42:19 -04:00
parent ad5604db14
commit 30d558177e

View file

@ -498,10 +498,10 @@ class MsG:
raise exc.GoTo 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']): 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 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']): 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 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 return False
def on_message(msg): def on_message(msg):
@ -531,7 +531,7 @@ class MsG:
paginator = await dest.send(embed=embed) 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 paginator.add_reaction(emoji)
await ctx.message.add_reaction('\N{OCTAGONAL SIGN}') await ctx.message.add_reaction('\N{OCTAGONAL SIGN}')
await asyncio.sleep(1) await asyncio.sleep(1)
@ -570,6 +570,16 @@ class MsG:
else: else:
await paginator.edit(content='**First image.**') 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: except exc.Right:
if c < len(keys): if c < len(keys):
c += 1 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) 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: except exc.Abort:
try: try:
await paginator.edit(content='**Exited paginator.**') await paginator.edit(content='**Exited paginator.**')
@ -683,10 +683,10 @@ class MsG:
raise exc.GoTo 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']): 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 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']): 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 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 return False
def on_message(msg): def on_message(msg):
@ -719,7 +719,7 @@ class MsG:
paginator = await dest.send(embed=embed) 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 paginator.add_reaction(emoji)
await ctx.message.add_reaction('\N{OCTAGONAL SIGN}') await ctx.message.add_reaction('\N{OCTAGONAL SIGN}')
await asyncio.sleep(1) await asyncio.sleep(1)
@ -757,6 +757,16 @@ class MsG:
else: else:
await paginator.edit(content='**First image.**') 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: except exc.Right:
if c % limit == 0: if c % limit == 0:
await dest.trigger_typing() await dest.trigger_typing()
@ -777,16 +787,6 @@ class MsG:
embed.set_image(url=values[c - 1]['url']) 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) 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: except exc.Abort:
try: try:
await paginator.edit(content='**Exited paginator.**') await paginator.edit(content='**Exited paginator.**')