diff --git a/Bot/Admin.fs b/Bot/Admin.fs index 67427de..24d2d5d 100644 --- a/Bot/Admin.fs +++ b/Bot/Admin.fs @@ -45,6 +45,20 @@ let sendEmbed embed (ctx : IDiscordContext) = do! Messaging.sendSimpleResponse ctx "Sent!" } :> Task +let updateEmbed embed (ctx : IDiscordContext) = + task { + match embed with + | InitEmbeds.Dojo -> Trainer.sendInitialEmbed ctx + | InitEmbeds.Whitelist -> Whitelist.sendInitialEmbed ctx + | InitEmbeds.Recruit -> InviteTracker.sendInitialEmbed ctx + | InitEmbeds.Slots -> SlotMachine.sendInitialEmbedFromSlashCommand ctx + | InitEmbeds.JpegStore -> Store.sendBackalleyEmbed ctx + | InitEmbeds.Armory -> Store.sendArmoryEmbed ctx + | InitEmbeds.Wallet -> InviteTracker.sendSubmitEmbed ctx + | _ -> () + do! Messaging.sendSimpleResponse ctx "Sent!" + } :> Task + let getAllReactions (msg : DiscordMessage) (ctx : IDiscordContext) : Task = task { let mutable listOfUsers = ResizeArray(512) @@ -157,10 +171,15 @@ type AdminBot() = enforceAdmin (DiscordInteractionContext ctx) (Whitelist.setCurrentWhitelistStock (int amount * 1)) [] - [] + [] member this.SendEmbedToChannel (ctx : InteractionContext, [] embed : InitEmbeds) = enforceAdmin (DiscordInteractionContext ctx) (sendEmbed embed) + [] + [] + member this.UpdateEmbedInChannel (ctx : InteractionContext, [] embed : InitEmbeds) = + enforceAdmin (DiscordInteractionContext ctx) (updateEmbed embed) + [] [] member this.GetMessageReactions (ctx : InteractionContext, diff --git a/Bot/InviteTracker.fs b/Bot/InviteTracker.fs index 57bb908..13af93f 100644 --- a/Bot/InviteTracker.fs +++ b/Bot/InviteTracker.fs @@ -373,9 +373,16 @@ To confirm your **Whitelist** please submit it below: let btn = DiscordButtonComponent(ButtonStyle.Success, "WalletStatus", "Check Status") :> DiscordComponent builder.AddComponents [| btn |] |> ignore - do! GuildEnvironment.botClientRecruit.Value.SendMessageAsync(channel, builder) - |> Async.AwaitTask - |> Async.Ignore + let! msgs = channel.GetMessagesAsync() |> Async.AwaitTask + let recruitBot = GuildEnvironment.botClientRecruit.Value + match msgs |> Seq.tryHead with + | Some msg -> + if msg.Author.Id = recruitBot.CurrentUser.Id then + do! msg.ModifyAsync(builder) |> Async.AwaitTask |> Async.Ignore + | None -> + do! recruitBot.SendMessageAsync(channel, builder) + |> Async.AwaitTask + |> Async.Ignore with e -> printfn $"Error trying to get channel Whitelist\n\n{e.Message}" } |> Async.RunSynchronously