Base game works but no win logic

This commit is contained in:
2023-07-19 10:45:42 +10:00
parent 72aa847663
commit 33a1fb01f6
5 changed files with 448 additions and 399 deletions

View File

@@ -62,11 +62,11 @@ async def test(interaction:discord.Interaction):
class HitOrStand(discord.ui.View):
def __init__(self, *, timeout=180):
super().__init__(timeout=timeout)
self.content = None
self.content = False
@discord.ui.button(label="Hit", style=discord.ButtonStyle.green)
async def hit(self, interaction: discord.Interaction, button: discord.ui.Button):
self.content = "h"
self.content = True
for child in self.children:
child.disabled = True
await interaction.response.edit_message(content="You Hit!", view=self)
@@ -74,7 +74,7 @@ class HitOrStand(discord.ui.View):
@discord.ui.button(label="Stand", style=discord.ButtonStyle.red)
async def stand(self, interaction: discord.Interaction, button: discord.ui.Button):
self.content = "s"
self.content = False
for child in self.children:
child.disabled = True
await interaction.response.edit_message(content="You stood!", view=self)
@@ -85,7 +85,8 @@ async def bj(interaction: discord.Interaction):
discinput = lambda m: discordInput(interaction, m)
discoutput = lambda m: discordOutput(interaction, m)
await interaction.response.send_message("Let's play Black Jack!")
await blackJack.play_game(interaction.user.id, 100, discinput, discoutput)
await blackJack.play_game(discinput, discoutput)
# await blackJack.play_game(interaction.user.id, 100, discinput, discoutput)
async def discordInput(interaction: discord.Interaction, message:str):
response = HitOrStand()