diff --git a/Bot/Bot.fs b/Bot/Bot.fs index 7a2f599..0cbe48c 100644 --- a/Bot/Bot.fs +++ b/Bot/Bot.fs @@ -100,15 +100,15 @@ 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 storeBot.ConnectAsync() |> Async.AwaitTask |> Async.RunSynchronously GuildEnvironment.botClientStore <- Some storeBot -hackerBattleBot.ConnectAsync() |> Async.AwaitTask |> Async.RunSynchronously -GuildEnvironment.botClientHacker <- Some hackerBattleBot - adminBot.ConnectAsync() |> Async.AwaitTask |> Async.RunSynchronously inviterBot.ConnectAsync() |> Async.AwaitTask |> Async.RunSynchronously diff --git a/Bot/Games/HackerBattle.fs b/Bot/Games/HackerBattle.fs index c6334bd..82548eb 100644 --- a/Bot/Games/HackerBattle.fs +++ b/Bot/Games/HackerBattle.fs @@ -128,7 +128,6 @@ let hackerResult successfulHack (ctx : IDiscordContext) attacker defender (hack do! updateEvents successfulHack attacker defender hack let! defenderMember = ctx.GetGuild().GetMemberAsync(defender.DiscordId) |> Async.AwaitTask -// let failedMsg = $"Hack failed! {defender.Name} was able to mount a successful defense! You lost {lostAmount} 💰$GBT!" let embed = Embeds.responseSuccessfulHack2 successfulHack attacker defender (ctx.GetDiscordMember()) defenderMember prizeAmount bonus hack do! ctx.GetChannel().SendMessageAsync(embed) |> Async.AwaitTask diff --git a/Bot/PlayerInteractions.fs b/Bot/PlayerInteractions.fs index 16bdedc..0962d97 100644 --- a/Bot/PlayerInteractions.fs +++ b/Bot/PlayerInteractions.fs @@ -3,6 +3,7 @@ module Degenz.PlayerInteractions open System.Threading.Tasks open DSharpPlus open DSharpPlus.Entities +open DSharpPlus.EventArgs open Degenz.Messaging open Degenz.DbService @@ -19,8 +20,20 @@ let executePlayerAction (ctx : IDiscordContext) (dispatch : PlayerData -> Async< let executePlayerActionNoMsg (ctx : IDiscordContext) (dispatch : PlayerData -> Async) = async { - let builder = DiscordInteractionResponseBuilder().AsEphemeral(true) - do! ctx.Respond(InteractionResponseType.DeferredMessageUpdate, builder) |> Async.AwaitTask + let eventCtx = ctx.GetContext() :?> ComponentInteractionCreateEventArgs + + let disabledButtons = + eventCtx.Message.Components + |> Seq.map (fun c -> c.Components |> Seq.cast) + |> Seq.concat + |> Seq.map (fun btn -> DiscordButtonComponent(btn.Style, btn.CustomId, btn.Label, disabled = true)) + |> Seq.cast + + let builder = DiscordInteractionResponseBuilder() + .AddEmbeds(eventCtx.Message.Embeds) + .AddComponents(disabledButtons) + + do! ctx.Respond(InteractionResponseType.UpdateMessage, builder) |> Async.AwaitTask let! playerResult = tryFindPlayer (ctx.GetDiscordMember().Id) match playerResult with | Some player -> do! dispatch player