use already existing variable

This commit is contained in:
Mylloon 2021-08-22 15:57:43 +02:00
parent 79a1630d4b
commit 41dd47e6bd
3 changed files with 10 additions and 10 deletions

View file

@ -162,13 +162,13 @@ class ReminderDiscord(commands.Cog, name="Reminder"):
if fromSlash != True: if fromSlash != True:
await addReaction(ctx.message, 0) await addReaction(ctx.message, 0)
embed, pageMAX, refresh = await embedListeReminder(utilisateur, ctx.guild.id, page) embed, pageMAX = await embedListeReminder(utilisateur, ctx.guild.id, page)
message = await ctx.send(embed = embed) message = await ctx.send(embed = embed)
if refresh: if pageMAX > 1:
await message.add_reaction("🔄")
elif pageMAX > 1:
for emoji in ["⬅️", "➡️"]: for emoji in ["⬅️", "➡️"]:
await message.add_reaction(emoji) await message.add_reaction(emoji)
else:
await message.add_reaction("🔄")
@cog_ext.cog_slash(name="reminderlist", description = "Affiche la liste des rappels d'un utilisateur.") @cog_ext.cog_slash(name="reminderlist", description = "Affiche la liste des rappels d'un utilisateur.")
async def __reminderlist(self, ctx, userorpage = None): async def __reminderlist(self, ctx, userorpage = None):
"""Slash command""" """Slash command"""

View file

@ -48,16 +48,16 @@ async def listReaction(client, payload):
if payload.emoji.name == "🔄": if payload.emoji.name == "🔄":
refresh_message = message refresh_message = message
if type == 0: if type == 0:
embed, _, refresh = await embedListeReminder(utilisateur, payload.guild_id, page, embed["color"], refresh_message) embed, pageMAX = await embedListeReminder(utilisateur, payload.guild_id, page, embed["color"], refresh_message)
elif type == 1: elif type == 1:
embed, _, refresh = await embedListeToDo(utilisateur, page, embed["color"], refresh_message) embed, pageMAX = await embedListeToDo(utilisateur, page, embed["color"], refresh_message)
if embed == False: if embed == False:
return False, False return False, False
if refresh == True: if pageMAX > 1:
await removeReactions(message, ["🔄"])
else:
await message.add_reaction("🔄") await message.add_reaction("🔄")
await removeReactions(message, ["⬅️", "➡️"]) await removeReactions(message, ["⬅️", "➡️"])
else:
await removeReactions(message, ["🔄"])
return message, embed return message, embed
return False, False return False, False

View file

@ -109,4 +109,4 @@ async def embedListeReminder(utilisateur, guildID, page, color = None, refresh_m
else: else:
embed.add_field(name = "\u200b", value = f"L'utilisateur n'a aucun rappel en attente ou page n°{page} vide !") embed.add_field(name = "\u200b", value = f"L'utilisateur n'a aucun rappel en attente ou page n°{page} vide !")
embed.set_footer(text = "Les rappels qui ont déjà expirés vont apparaître dans quelques instants.\nIls peuvent avoir jusqu'à 1 minute de retard maximum.") embed.set_footer(text = "Les rappels qui ont déjà expirés vont apparaître dans quelques instants.\nIls peuvent avoir jusqu'à 1 minute de retard maximum.")
return (embed, pageMAX, refresh) return (embed, pageMAX)