This commit is contained in:
Joseph Ferano 2022-06-20 23:28:07 +07:00
parent 8e15299b57
commit 387fc239a6

View File

@ -438,24 +438,33 @@ let handleJpegEvents _ (event : ComponentInteractionCreateEventArgs) =
let handleStoreEvents _ (event : ComponentInteractionCreateEventArgs) =
let ctx = DiscordEventContext event :> IDiscordContext
let id = ctx.GetInteractionId()
let itemId = id.Split("-").[1]
let storeId = id.Split("-").[2]
match id with
| id when id.StartsWith("Buy") -> handleBuyItem (fun _ -> Task.CompletedTask) ctx itemId
| id when id.StartsWith("Sell") -> handleSell ctx itemId
| id when id.StartsWith("ShowHacks") -> buy storeId (Some ItemType.Hack) ctx
| id when id.StartsWith("ShowShields") -> buy storeId (Some ItemType.Shield) ctx
| _ ->
task {
let builder = DiscordInteractionResponseBuilder()
builder.IsEphemeral <- true
builder.Content <- $"Incorrect Action identifier {id}"
do! ctx.Respond(InteractionResponseType.ChannelMessageWithSource, builder) |> Async.AwaitTask
}
|> Async.AwaitTask
|> Async.Start
Task.CompletedTask
task {
let builder = DiscordInteractionResponseBuilder()
builder.IsEphemeral <- true
builder.Content <- $"🚀 __Mint Date:__ June 20th 6:30 UTC <t:1655749800:R>"
do! ctx.Respond(InteractionResponseType.ChannelMessageWithSource, builder) |> Async.AwaitTask
} : Task
//let handleStoreEvents _ (event : ComponentInteractionCreateEventArgs) =
// let ctx = DiscordEventContext event :> IDiscordContext
// let id = ctx.GetInteractionId()
// let itemId = id.Split("-").[1]
// let storeId = id.Split("-").[2]
// match id with
// | id when id.StartsWith("Buy") -> handleBuyItem (fun _ -> Task.CompletedTask) ctx itemId
// | id when id.StartsWith("Sell") -> handleSell ctx itemId
// | id when id.StartsWith("ShowHacks") -> buy storeId (Some ItemType.Hack) ctx
// | id when id.StartsWith("ShowShields") -> buy storeId (Some ItemType.Shield) ctx
// | _ ->
// task {
// let builder = DiscordInteractionResponseBuilder()
// builder.IsEphemeral <- true
// builder.Content <- $"Incorrect Action identifier {id}"
// do! ctx.Respond(InteractionResponseType.ChannelMessageWithSource, builder) |> Async.AwaitTask
// }
// |> Async.AwaitTask
// |> Async.Start
// Task.CompletedTask
let sendBackalleyEmbed (ctx : IDiscordContext) =
async {