Skip to content

Commit

Permalink
Fixed hit button from not registering when clicked
Browse files Browse the repository at this point in the history
  • Loading branch information
PieTw3lve committed Jul 19, 2024
1 parent 5168158 commit 3425336
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/extensions/economy/blackjack.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ def __init__(self, embed: hikari.Embed, author: hikari.User, bet: int, deck: Dec
self.player = player
self.dealer = dealer

@miru.button(label='Hit', style=hikari.ButtonStyle.SUCCESS)
@miru.button(label='Hit', style=hikari.ButtonStyle.SUCCESS, custom_id='hit')
async def hit(self, ctx: miru.ViewContext, button: miru.Button) -> None:
self.player.hand.hit()
self.double.disabled = True
self.get_item_by_id(custom_id='double').disabled = True

if self.player.hand.is_busted():
self.embed.title = 'You Busted!' # Your hand went over 21
Expand All @@ -115,7 +115,7 @@ async def hit(self, ctx: miru.ViewContext, button: miru.Button) -> None:
self.embed.edit_field(1, "Your Hand", f'{" ".join(self.player.cards())}\nValue: {self.player.hand.score()}')
await ctx.edit_response(self.embed, components=self)

@miru.button(label='Stand', style=hikari.ButtonStyle.PRIMARY)
@miru.button(label='Stand', style=hikari.ButtonStyle.PRIMARY, custom_id='stand')
async def stand(self, ctx: miru.ViewContext, button: miru.Button) -> None:
while self.dealer.hand.score() < 17:
self.dealer.hand.hit()
Expand Down Expand Up @@ -168,7 +168,7 @@ async def stand(self, ctx: miru.ViewContext, button: miru.Button) -> None:

await ctx.edit_response(self.embed, components=[])

@miru.button(label='Double Down', style=hikari.ButtonStyle.DANGER)
@miru.button(label='Double Down', style=hikari.ButtonStyle.DANGER, custom_id='double')
async def double(self, ctx: miru.ViewContext, button: miru.Button) -> None:
if economy.remove_money(self.author.id, self.bet, False) == False:
embed = hikari.Embed(description='You do not have enough money!', color=get_setting('settings', 'embed_error_color'))
Expand Down

0 comments on commit 3425336

Please sign in to comment.