Work on the messaging for the hacking

This commit is contained in:
Joseph Ferano 2022-06-19 22:05:59 +07:00
parent 36e6225201
commit c1697e8ded
2 changed files with 11 additions and 4 deletions

View File

@ -130,19 +130,26 @@ let responseSuccessfulHack (hacker : PlayerData) (target : PlayerData) totalTake
let responseSuccessfulHack2 successful (hacker : PlayerData) (target : PlayerData) (hackerMember : DiscordMember) (targetMember : DiscordMember) totalTaken bonus (hack : HackItem) =
let earnedMoney = totalTaken > 0<GBT>
let msg = $"{hacker.Name} successfully hacked <@{target.DiscordId}> using {hack.Name}!\n\n"
+ (if earnedMoney then $"**__Total Stolen__**: {totalTaken} 💰$GBT\n" else "")
let msg =
if successful then
$"{hacker.Name} successfully hacked <@{target.DiscordId}>!\n\n"
+ (if earnedMoney then $"**__Total Hacked__**: `{totalTaken} 💰$GBT`\n" else "")
else
$"{hacker.Name} failed to hack <@{target.DiscordId}>!\n\n"
+ (if earnedMoney then $"**__Defender Extracted__**: `{totalTaken} 💰$GBT`\n" else "")
let bonusMsg =
if bonus > 0<GBT>
then $"Because **{hacker.Name}** strength is `💪 {hacker.Stats.Strength.Amount}` and **{target.Name}** strength is `💪 {target.Stats.Strength.Amount}`, they got a `{bonus}` 💰$GBT bonus"
else ""
let title = if successful then "✅ Hack Successful!" else "❌ Hack Failed!"
let embed1 =
DiscordEmbedBuilder()
.WithThumbnail(hackGif)
.WithColor(DiscordColor.Blurple)
.WithTitle("✅ Hack Successful!")
.WithTitle(title)
.WithDescription($"{msg}\n{bonusMsg}")
let h = ( hacker.Name , hackerMember.AvatarUrl )

View File

@ -9,7 +9,7 @@ open Degenz.DbService
let executePlayerAction (ctx : IDiscordContext) (dispatch : PlayerData -> Async<unit>) =
async {
let builder = DiscordInteractionResponseBuilder().AsEphemeral(true)
do! ctx.Respond(InteractionResponseType.DeferredMessageUpdate, builder) |> Async.AwaitTask
do! ctx.Respond(InteractionResponseType.DeferredChannelMessageWithSource, builder) |> Async.AwaitTask
let! playerResult = tryFindPlayer (ctx.GetDiscordMember().Id)
match playerResult with
| Some player -> do! dispatch player