mirror of
https://github.com/wlinator/luminara.git
synced 2024-10-02 18:23:12 +00:00
chore: Fix blackjack timeout handling
This commit is contained in:
parent
b62d8d5d1b
commit
7931957ec0
1 changed files with 7 additions and 10 deletions
|
@ -25,7 +25,6 @@ async def cmd(ctx, bet: int):
|
|||
3 = dealer busted
|
||||
4 = dealer won
|
||||
5 = player won with 21 (blackjack)
|
||||
6 = timed out
|
||||
"""
|
||||
|
||||
# check if the player already has an active blackjack going
|
||||
|
@ -98,8 +97,10 @@ async def cmd(ctx, bet: int):
|
|||
status = 3 if dealer_hand_value > 21 else 4
|
||||
break
|
||||
else:
|
||||
status = 6
|
||||
break
|
||||
# timed out
|
||||
ctx_currency.take_balance(bet)
|
||||
ctx_currency.push()
|
||||
raise LumiException(CONST.STRINGS["error_out_of_time_economy"])
|
||||
|
||||
# refresh
|
||||
view = interaction.BlackJackButtons(ctx)
|
||||
|
@ -117,6 +118,7 @@ async def cmd(ctx, bet: int):
|
|||
"""
|
||||
At this point the game has concluded, generate a final output & backend
|
||||
"""
|
||||
|
||||
payout = bet * multiplier if status != 5 else bet * 2
|
||||
is_won = status not in [1, 4]
|
||||
|
||||
|
@ -149,12 +151,6 @@ async def cmd(ctx, bet: int):
|
|||
hand_player=player_hand,
|
||||
hand_dealer=dealer_hand,
|
||||
)
|
||||
stats.push()
|
||||
|
||||
elif status == 6:
|
||||
ctx_currency.take_balance(bet)
|
||||
ctx_currency.push()
|
||||
raise LumiException(CONST.STRINGS["error_out_of_time_economy"])
|
||||
|
||||
else:
|
||||
ctx_currency.add_balance(payout)
|
||||
|
@ -169,7 +165,8 @@ async def cmd(ctx, bet: int):
|
|||
hand_player=player_hand,
|
||||
hand_dealer=dealer_hand,
|
||||
)
|
||||
stats.push()
|
||||
|
||||
stats.push()
|
||||
|
||||
except Exception as e:
|
||||
# await ctx.respond(embed=GenericErrors.default_exception(ctx))
|
||||
|
|
Loading…
Reference in a new issue