From f6ea33d51c71ac75b8807053dc61f9449210d78c Mon Sep 17 00:00:00 2001 From: Emmy D'Anello Date: Wed, 12 Mar 2025 00:20:03 +0100 Subject: [PATCH] =?UTF-8?q?Correction=20messages=20envoy=C3=A9s=20apr?= =?UTF-8?q?=C3=A8s=20d=C3=A9fi=20termin=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bot.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bot.py b/bot.py index da3b7b0..49f56fe 100755 --- a/bot.py +++ b/bot.py @@ -263,7 +263,7 @@ class MainView(discord.ui.View): async def terminer_defi(self, id_defi: int, user_id: int, interaction: discord.Interaction): await interaction.response.defer() - await terminer(ctx, id_defi, user_id) + await terminer(ctx, id_defi, user_id, interaction.channel) for id_defi in defis: defi = next(defi for defi in DEFIS['capture'] if defi['id'] == id_defi) @@ -298,7 +298,7 @@ async def afficher_main(ctx: commands.Context, mode: Literal['public', 'prive'] @bot.command() -async def terminer(ctx: commands.Context, id_defi: int, author_id: int | None = None): +async def terminer(ctx: commands.Context, id_defi: int, author_id: int | None = None, channel: discord.abc.Messageable | None = None): if all(id_defi != defi['id'] for defi in DEFIS['capture']): raise commands.BadArgument(f"Erreur : Le défi {id_defi_1} n'existe pas") defi = next(defi for defi in DEFIS['capture'] if defi['id'] == id_defi) @@ -320,6 +320,7 @@ async def terminer(ctx: commands.Context, id_defi: int, author_id: int | None = with DATA_FILE.open('w') as data_file: json.dump(data, data_file, indent=2) + channel = channel or ctx await ctx.send(f"Défi n°{id_defi} **{defi['nom']}** terminé ! Il est retiré de votre main.") colour = discord.Color.red() if equipe == "rouge" else discord.Color.green() embed = discord.Embed(title=nouveau_defi['nom'], description=nouveau_defi['description'], colour=colour)