From dfac15796ed51631a7a4801d76330f52124600a6 Mon Sep 17 00:00:00 2001 From: Emmy D'Anello Date: Wed, 12 Mar 2025 00:08:16 +0100 Subject: [PATCH] =?UTF-8?q?Correction=20boutons=20par=20utilisateur?= =?UTF-8?q?=E2=8B=85rice?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bot.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bot.py b/bot.py index baaaec1..da3b7b0 100755 --- a/bot.py +++ b/bot.py @@ -258,17 +258,17 @@ async def remiser(ctx: commands.Context, type_defi: Literal['capture', 'competit class MainView(discord.ui.View): - def __init__(self, ctx: commands.Context, defis: list[dict], timeout: float | None = 180.0): + def __init__(self, ctx: commands.Context, user_id: int, defis: list[dict], timeout: float | None = 180.0): super().__init__(timeout=timeout) - async def terminer_defi(self, id_defi: int, interaction: discord.Interaction): + async def terminer_defi(self, id_defi: int, user_id: int, interaction: discord.Interaction): await interaction.response.defer() - await terminer(ctx, id_defi) + await terminer(ctx, id_defi, user_id) for id_defi in defis: defi = next(defi for defi in DEFIS['capture'] if defi['id'] == id_defi) button = discord.ui.Button(style=discord.ButtonStyle.success, label=f"Terminer {defi['nom']}") - button.callback = partial(terminer_defi, self, id_defi) + button.callback = partial(terminer_defi, self, id_defi, user_id) self.add_item(button) @@ -294,7 +294,7 @@ async def afficher_main(ctx: commands.Context, mode: Literal['public', 'prive'] await ctx.send(f"Défis de l'équipe **{couleur}** :", embeds=embeds) else: channel_dm = await bot.create_dm(namedtuple('User', 'id')(author_id)) - await channel_dm.send("Vos défis en main :", embeds=embeds, view=MainView(ctx, main)) + await channel_dm.send("Vos défis en main :", embeds=embeds, view=MainView(ctx, author_id, main)) @bot.command()