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:
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)
if refresh:
await message.add_reaction("🔄")
elif pageMAX > 1:
if pageMAX > 1:
for emoji in ["⬅️", "➡️"]:
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.")
async def __reminderlist(self, ctx, userorpage = None):
"""Slash command"""

View file

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

View file

@ -109,4 +109,4 @@ async def embedListeReminder(utilisateur, guildID, page, color = None, refresh_m
else:
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.")
return (embed, pageMAX, refresh)
return (embed, pageMAX)