From c04f2f1f13d29f1d5b971d05637e55a41d7f04b9 Mon Sep 17 00:00:00 2001 From: BigGamerGary Date: Wed, 23 Nov 2022 21:36:58 +1000 Subject: [PATCH] Buttons work --- Acronymbot.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Acronymbot.py b/Acronymbot.py index 9068186..c299386 100644 --- a/Acronymbot.py +++ b/Acronymbot.py @@ -28,10 +28,20 @@ class HitOrStand(discord.ui.View): @discord.ui.button(label="Hit", style=discord.ButtonStyle.green) async def hit(self, interaction: discord.Interaction, button: discord.ui.Button): self.content = "h" + for child in self.children: + child.disabled = True + await interaction.response.edit_message(content="You Hit!", view=self) + self.stop() @discord.ui.button(label="Stand", style=discord.ButtonStyle.red) async def stand(self, interaction: discord.Interaction, button: discord.ui.Button): self.content = "s" + for child in self.children: + child.disabled = True + await interaction.response.edit_message(content="You stood!", view=self) + self.stop() + + class Buttons(discord.ui.View): def __init__(self, *, timeout=180): @@ -66,7 +76,7 @@ async def bj(interaction: discord.Interaction): async def discordInput(interaction: discord.Interaction, message:str): response = HitOrStand() await interaction.followup.send(message, view=response) - print(response.content) + await response.wait() return response.content async def discordOutput(interaction: discord.Interaction, message):