From b38d596bca99d8eab7a06b813ad7d59b0fa6cdb2 Mon Sep 17 00:00:00 2001 From: Anselme Date: Fri, 31 Jul 2026 14:41:44 +0200 Subject: [PATCH] fixed grammar in riddle --- fouras.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/fouras.py b/fouras.py index f19dd44..8fd3612 100644 --- a/fouras.py +++ b/fouras.py @@ -322,6 +322,18 @@ async def handle_message(message, client: discord.Client) -> bool: async def new_riddle(interaction: Interaction, index: int) -> None: + class ConfirmRiddle(discord.ui.View): + def __init__(self): + super().__init__(timeout=60) + + @discord.ui.button(label="Oui", style=discord.ButtonStyle.success) + async def yes(self, interaction: discord.Interaction, button: discord.ui.Button): + await interaction.response.send_message("Confirmé.", ephemeral=True) + + @discord.ui.button(label="Non", style=discord.ButtonStyle.danger) + async def no(self, interaction: discord.Interaction, button: discord.ui.Button): + await interaction.response.send_message("Annulé.", ephemeral=True) + if random.random() <= 0.03: await interaction.response.send_message("Non") else: @@ -447,3 +459,28 @@ def setup_commands(client: discord.Client, tree) -> None: if(not await update_riddle_message(interaction.channel, current_riddle)): return await interaction.response.send_message("Nouvel indice : `{0}`".format(clue_string(answer, nb_clues))) + + @tree.command( + name="testmodal" + ) + async def testmodal( + interaction: Interaction + ): + class Confirm(discord.ui.View): + def __init__(self): + super().__init__(timeout=60) + + @discord.ui.button(label="Oui", style=discord.ButtonStyle.success) + async def yes(self, interaction: discord.Interaction, button: discord.ui.Button): + await interaction.response.send_message("✅ Confirmé.", ephemeral=True) + + @discord.ui.button(label="Non", style=discord.ButtonStyle.danger) + async def no(self, interaction: discord.Interaction, button: discord.ui.Button): + await interaction.response.send_message("❌ Annulé.", ephemeral=True) + + view = Confirm() + await interaction.response.send_message( + "Es-tu sûr ?", + view=view, + ephemeral=True + )