diff options
author | 2020-02-17 11:35:14 +0200 | |
---|---|---|
committer | 2020-02-17 11:35:14 +0200 | |
commit | cd4841aa6407ab6bece89d12d9645dab56f18d89 (patch) | |
tree | 191695f660bc5320b5e58f72088ec2b6510b3d47 | |
parent | Paginator Migration - Emoji and actions (diff) |
Pagination migrations - Actions and emojis
Clicking on [:trashcan:] broke the loop and deleted the message,
instead, now we return after a message deletion and break when
an `asyncio.TimeoutError` is raised
(when a user fails to add reactions in time)
-rw-r--r-- | bot/pagination.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/bot/pagination.py b/bot/pagination.py index 841e33eb..b5bb1720 100644 --- a/bot/pagination.py +++ b/bot/pagination.py @@ -187,7 +187,7 @@ class LinePaginator(Paginator): if str(reaction.emoji) == DELETE_EMOJI: # Note: DELETE_EMOJI is a string and not unicode log.debug("Got delete reaction") - break + return await message.delete() if reaction.emoji == FIRST_EMOJI: await message.remove_reaction(reaction.emoji, user) @@ -261,8 +261,8 @@ class LinePaginator(Paginator): await message.edit(embed=embed) - log.debug("Ending pagination and deleting the message") - await message.delete() + log.debug("Ending pagination and clearing reactions...") + await message.clear_reactions() class ImagePaginator(Paginator): @@ -372,7 +372,7 @@ class ImagePaginator(Paginator): # Delete reaction press - [:trashcan:] if str(reaction.emoji) == DELETE_EMOJI: # Note: DELETE_EMOJI is a string and not unicode log.debug("Got delete reaction") - break + return await message.delete() # First reaction press - [:track_previous:] if reaction.emoji == FIRST_EMOJI: @@ -424,5 +424,5 @@ class ImagePaginator(Paginator): await message.edit(embed=embed) - log.debug("Ending pagination and deleting the message") - await message.delete() + log.debug("Ending pagination and clearing reactions...") + await message.clear_reactions() |