Fix bug to get HoP message working

This commit is contained in:
Joseph Ferano 2022-04-21 10:20:46 +07:00
parent 1d9dddfec0
commit b78fce3cad

View File

@ -97,7 +97,6 @@ let printOddsTable symbols (prizeTable : PrizeEntry array) =
//printOddsTable symbols prizeTable
let getReel fn = List.fold (fun acc elem -> (List.replicate (fn elem) elem) @ acc) [] symbols |> List.toArray
let reel1 = getReel (fun s -> s.reel1Count)
let reel2 = getReel (fun s -> s.reel2Count)
@ -168,7 +167,7 @@ let resetJackpot amount =
GuildEnvironment.connectionString
|> Sql.connect
|> Sql.parameters [ ( "amount" , Sql.int (int amount) ) ]
|> Sql.query "UPDATE item SET stock = amount WHERE symbol = 'JACKPOT'"
|> Sql.query "UPDATE item SET stock = @amount WHERE symbol = 'JACKPOT'"
|> Sql.executeNonQueryAsync
|> Async.AwaitTask
@ -274,7 +273,6 @@ let spin multiplier (ctx : IDiscordContext) =
do! DbService.updatePlayerCurrency prizeWithMultiplier player |> Async.Ignore
embed.Color <- DiscordColor.Green
embed.Description <- $"You WIN `💰` **{prizeWithMultiplier}** GBT 🎉"
// embed.AddField("Result", $"{slotsContent}", true) |> ignore
embed.AddField("Bet", $"{playAmount}", true) |> ignore
embed.AddField("Prize", $"{prizeWithMultiplier}") |> ignore
addGBTField embed prizeWithMultiplier
@ -283,7 +281,6 @@ let spin multiplier (ctx : IDiscordContext) =
let! jackpot = getJackpotAmount ()
embed.Color <- DiscordColor.Green
embed.Description <- $"🎉🎉 YOU HIT THE JACKPOT 🎉🎉"
// embed.AddField("Result", $"{slotsContent}", true) |> ignore
embed.AddField("Bet", $"{playAmount}", true) |> ignore
embed.AddField("Prize", $"{jackpot}") |> ignore
addGBTField embed jackpot
@ -292,11 +289,9 @@ let spin multiplier (ctx : IDiscordContext) =
return "JACKPOT" , jackpot
| None ->
do! incrementJackpot playAmount |> Async.Ignore
embed.Description <- $"You LOST `💰` **{playAmount}** $GBT `😭`"
embed.Description <- $"You LOST `💰` **{playAmount}** $GBT 😭"
embed.Color <- DiscordColor.Red
embed.AddField("Bet", $"{playAmount}", true) |> ignore
// embed.AddField("New JACKPOT", $"`💰` {jackpot} `$GBT`", true) |> ignore
// embed.AddField("Result", $"{slotsContent}", true) |> ignore
addGBTField embed -playAmount
return "LOST" , 0<GBT>
}
@ -304,6 +299,18 @@ let spin multiplier (ctx : IDiscordContext) =
let button = DiscordButtonComponent(ButtonStyle.Success, $"spin-{multiplier}x", $"🎰 Spin Again") :> DiscordComponent
dwb.AddComponents([| button |]).AddEmbed(embed).WithContent(slotsContent) |> ignore
do! itx.EditFollowupMessageAsync(followUpMessage.Id, dwb) |> Async.AwaitTask |> Async.Ignore
let hopMsg = DiscordMessageBuilder()
hopMsg.Content <-
let s1 = $"{slotsContent} | {player.Name}"
match result with
| "WON" -> s1 + $" **WON** {prizeAmount} $GBT playing slots!"
| "LOST" -> s1 + $" **LOST** playing slots"
| "JACKPOT" -> s1 + $" 🎉🎉🎉 **JUST HIT THE JACKPOT** and **WON**!!! 🎉🎉🎉"
| _ -> ""
let channel = ctx.GetGuild().GetChannel(GuildEnvironment.channelEventsHackerBattle)
do! channel.SendMessageAsync(hopMsg) |> Async.AwaitTask |> Async.Ignore
do! Analytics.slotPlayed (ctx.GetDiscordMember()) playAmount result prizeAmount
}
PlayerInteractions.executePlayerAction ctx (fun player -> async {