From 76962e6936c37b7f00706f3adcc2856c4d18cbbd Mon Sep 17 00:00:00 2001 From: Mylloon Date: Sun, 22 Aug 2021 16:23:48 +0200 Subject: [PATCH] always refresh even when there is still nothing to show --- src/utils/page.py | 2 -- src/utils/reminder.py | 4 ++-- src/utils/todo.py | 4 ++-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/utils/page.py b/src/utils/page.py index a7335cd..00e2c53 100644 --- a/src/utils/page.py +++ b/src/utils/page.py @@ -51,8 +51,6 @@ async def listReaction(client, payload): embed, pageMAX = await embedListeReminder(utilisateur, payload.guild_id, page, embed["color"], refresh_message) elif type == 1: embed, pageMAX = await embedListeToDo(utilisateur, page, embed["color"], refresh_message) - if embed == False: - return False, False if pageMAX > 1: await removeReactions(message, ["🔄"]) else: diff --git a/src/utils/reminder.py b/src/utils/reminder.py index 243b924..3a7bf71 100644 --- a/src/utils/reminder.py +++ b/src/utils/reminder.py @@ -80,7 +80,7 @@ async def embedListeReminder(utilisateur, guildID, page, color = None, refresh_m for emoji in ["⬅️", "➡️"]: await refresh_message.add_reaction(emoji) else: - return (False, False) + nothing = True if pageMAX == 1: page = 1 # force page 1 @@ -89,7 +89,7 @@ async def embedListeReminder(utilisateur, guildID, page, color = None, refresh_m embed = Embed(description = f"**Rappel{'s' if len(reminders) > 1 else ''} de {utilisateur.mention}** • Page {page}/{pageMAX}", color = color) embed.set_thumbnail(url = utilisateur.avatar_url_as(size = 64)) limit = 5 * page - if len(reminders) > 0 and page <= pageMAX: + if (len(reminders) > 0 and page <= pageMAX) or not nothing: curseur = limit - 4 for reminder in reminders[limit - 5:]: if curseur <= limit: diff --git a/src/utils/todo.py b/src/utils/todo.py index 37bb378..4115efd 100644 --- a/src/utils/todo.py +++ b/src/utils/todo.py @@ -68,7 +68,7 @@ async def embedListeToDo(utilisateur, page, color = None, refresh_message = None for emoji in ["⬅️", "➡️"]: await refresh_message.add_reaction(emoji) else: - return (False, False) + nothing = True if pageMAX == 1: page = 1 # force page 1 @@ -78,7 +78,7 @@ async def embedListeToDo(utilisateur, page, color = None, refresh_message = None embed = Embed(description = f"**To Do{s if len(todos) > 1 else ''} de {utilisateur.mention}** • Page {page}/{pageMAX}", color = color) embed.set_thumbnail(url = utilisateur.avatar_url_as(size = 64)) limit = 5 * page - if len(todos) > 0 and page <= pageMAX: + if (len(todos) > 0 and page <= pageMAX) or not nothing: curseur = limit - 4 for todo in todos[limit - 5:]: if curseur <= limit: