From b56457e25d1c324f19f930c1778e2687fbb1dd04 Mon Sep 17 00:00:00 2001 From: Joseph Ferano Date: Fri, 24 Jun 2022 11:33:26 +0700 Subject: [PATCH] Condense a little hack stuff --- Bot/Bot.fs | 5 ++--- Bot/Embeds.fs | 24 ++++++++---------------- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/Bot/Bot.fs b/Bot/Bot.fs index cfa3d8a..0cbe48c 100644 --- a/Bot/Bot.fs +++ b/Bot/Bot.fs @@ -100,6 +100,8 @@ let asdf _ (event : DSharpPlus.EventArgs.InteractionCreateEventArgs) = } |> Async.StartAsTask :> Task //hackerBattleBot.add_InteractionCreated(AsyncEventHandler(asdf)) +hackerBattleBot.ConnectAsync() |> Async.AwaitTask |> Async.RunSynchronously +GuildEnvironment.botClientHacker <- Some hackerBattleBot jpegBot.ConnectAsync() |> Async.AwaitTask |> Async.RunSynchronously GuildEnvironment.botClientJpeg <- Some jpegBot @@ -109,9 +111,6 @@ GuildEnvironment.botClientStore <- Some storeBot adminBot.ConnectAsync() |> Async.AwaitTask |> Async.RunSynchronously -hackerBattleBot.ConnectAsync() |> Async.AwaitTask |> Async.RunSynchronously -GuildEnvironment.botClientHacker <- Some hackerBattleBot - inviterBot.ConnectAsync() |> Async.AwaitTask |> Async.RunSynchronously GuildEnvironment.botClientRecruit <- Some inviterBot diff --git a/Bot/Embeds.fs b/Bot/Embeds.fs index 844a80f..3a32f5a 100644 --- a/Bot/Embeds.fs +++ b/Bot/Embeds.fs @@ -130,27 +130,19 @@ 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 - let msg = - if successful then - $"{hacker.Name} successfully hacked {target.Name}!\n\n" - + (if earnedMoney then $"**__Total Hacked__**: `{totalTaken} 💰$GBT`\n" else "") - else - $"{hacker.Name} failed to hack {target.Name}!\n\n" - + (if earnedMoney then $"**__Defender Extracted__**: `{totalTaken} 💰$GBT`\n" else "") - - let bonusMsg = - if bonus > 0 - 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 title = if successful then $"✅ {hacker.Name} Hacked Successful!" else $"❌ {target.Name} Hack Failed!" let embed1 = DiscordEmbedBuilder() - .WithThumbnail(hackGif) .WithColor(DiscordColor.Blurple) .WithTitle(title) - .WithDescription($"{msg}\n{bonusMsg}") + + if successful then + if earnedMoney then embed1.AddField($"Total Hacked", $"`{totalTaken} 💰$GBT`", true) |> ignore + else + if earnedMoney then embed1.AddField($"Defender Extracted", $"`{totalTaken} 💰$GBT`", true) |> ignore + + if bonus > 0 then embed1.AddField("Bonus", $"`{bonus}` 💰$GBT", true) |> ignore let h = ( hacker.Name , hackerMember.AvatarUrl ) let t = ( target.Name , targetMember.AvatarUrl )