diff --git a/Acronymbot.py b/Acronymbot.py index 1caa3ca..9068186 100644 --- a/Acronymbot.py +++ b/Acronymbot.py @@ -20,6 +20,19 @@ async def test(interaction:discord.Interaction): except discord.app_commands.errors.CommandInvokeError: print("Uh oh! It failed!") +class HitOrStand(discord.ui.View): + def __init__(self, *, timeout=180): + super().__init__(timeout=timeout) + self.content = None + + @discord.ui.button(label="Hit", style=discord.ButtonStyle.green) + async def hit(self, interaction: discord.Interaction, button: discord.ui.Button): + self.content = "h" + + @discord.ui.button(label="Stand", style=discord.ButtonStyle.red) + async def stand(self, interaction: discord.Interaction, button: discord.ui.Button): + self.content = "s" + class Buttons(discord.ui.View): def __init__(self, *, timeout=180): super().__init__(timeout=timeout) @@ -51,11 +64,10 @@ async def bj(interaction: discord.Interaction): await blackJack.play_game(100) async def discordInput(interaction: discord.Interaction, message:str): - await interaction.followup.send(message) - def check(m): - return m.content in ["h", "s"] and m.channel == interaction.channel - msg = await client.wait_for('message', check=check) - return msg.content + response = HitOrStand() + await interaction.followup.send(message, view=response) + print(response.content) + return response.content async def discordOutput(interaction: discord.Interaction, message): await interaction.followup.send(message) diff --git a/__pycache__/BlackJack.cpython-310.pyc b/__pycache__/BlackJack.cpython-310.pyc index 85398a4..fbb709f 100644 Binary files a/__pycache__/BlackJack.cpython-310.pyc and b/__pycache__/BlackJack.cpython-310.pyc differ