This commit is contained in:
Joseph Ferano 2022-05-06 19:06:26 +07:00
parent a4b0834047
commit faa45a49f7
2 changed files with 5 additions and 5 deletions

View File

@ -302,7 +302,7 @@ let updatePlayerCurrency (addAmount : int<GBT>) (did : uint64) =
"did", Sql.string (string did)
"gbt", Sql.int (int addAmount)
] |> Sql.query """
UPDATE "user" SET gbt = gbt + GREATEST(gbt + @gbt, 0) WHERE discord_id = @did;
UPDATE "user" SET gbt = GREATEST(gbt + @gbt, 0) WHERE discord_id = @did;
"""
|> Sql.executeNonQueryAsync
|> Async.AwaitTask

View File

@ -270,11 +270,11 @@ let spin multiplier (ctx : IDiscordContext) =
embed.Color <- DiscordColor.Green
embed.Description <- $"🎉🎉 YOU HIT THE JACKPOT 🎉🎉"
embed.AddField("Bet", $"{playAmount}", true) |> ignore
embed.AddField("Prize", $"{jackpot}", true) |> ignore
addGBTField embed (Inventory.getBuyPrice jackpot.Item)
do! DbService.updatePlayerCurrency (Inventory.getBuyPrice jackpot.Item) player.DiscordId |> Async.Ignore
embed.AddField("Prize", $"{jackpot.Stock}", true) |> ignore
addGBTField embed (jackpot.Stock * 1<GBT>)
do! DbService.updatePlayerCurrency (jackpot.Stock * 1<GBT>) player.DiscordId |> Async.Ignore
do! DbService.setItemStock BaseJackpotAmount "JACKPOT" |> Async.Ignore
return "JACKPOT" , Inventory.getBuyPrice jackpot.Item
return "JACKPOT" , jackpot.Stock * 1<GBT>
| None ->
do! DbService.incrementItemStock 1<GBT> "JACKPOT" |> Async.Ignore
embed.Description <- $"You LOST `💰` **{playAmount}** $GBT 😭"