Not sure if we're going to do it this way

This commit is contained in:
Joseph Ferano 2022-05-18 23:48:23 +07:00
parent e1e1b96543
commit d2d18114ef
2 changed files with 30 additions and 4 deletions

View File

@ -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<DiscordUser seq> =
task {
let mutable listOfUsers = ResizeArray<DiscordUser>(512)
@ -157,10 +171,15 @@ type AdminBot() =
enforceAdmin (DiscordInteractionContext ctx) (Whitelist.setCurrentWhitelistStock (int amount * 1<GBT>))
[<SlashCommandPermissions(Permissions.Administrator)>]
[<SlashCommand("admin-send-embed", "Set whitelist stock", false)>]
[<SlashCommand("admin-embed-send", "Set whitelist stock", false)>]
member this.SendEmbedToChannel (ctx : InteractionContext, [<Option("embed", "Which embed to send")>] embed : InitEmbeds) =
enforceAdmin (DiscordInteractionContext ctx) (sendEmbed embed)
[<SlashCommandPermissions(Permissions.Administrator)>]
[<SlashCommand("admin-embed-update", "Set whitelist stock", false)>]
member this.UpdateEmbedInChannel (ctx : InteractionContext, [<Option("embed", "Which embed to send")>] embed : InitEmbeds) =
enforceAdmin (DiscordInteractionContext ctx) (updateEmbed embed)
[<SlashCommandPermissions(Permissions.Administrator)>]
[<SlashCommand("admin-get-msg-reactions", "Set whitelist stock", false)>]
member this.GetMessageReactions (ctx : InteractionContext,

View File

@ -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