Basic spin with images
This commit is contained in:
parent
70dbaf86ab
commit
0c1cf67bbf
@ -1,9 +1,11 @@
|
|||||||
|
open System
|
||||||
open System.Threading.Tasks
|
open System.Threading.Tasks
|
||||||
open DSharpPlus
|
open DSharpPlus
|
||||||
open DSharpPlus.Entities
|
open DSharpPlus.Entities
|
||||||
open DSharpPlus.SlashCommands
|
open DSharpPlus.SlashCommands
|
||||||
open Emzi0767.Utilities
|
open System.IO
|
||||||
open DegenzGame.Shared
|
|
||||||
|
let slots = [| "https://i.ibb.co/pKqZdr7/cherry.png" ; "https://i.ibb.co/Mk8wQmv/lemon.jpg" ; "https://i.ibb.co/1JTFPSs/seven.png" |]
|
||||||
|
|
||||||
type EmptyGlobalCommandToAvoidFamousDuplicateSlashCommandsBug() = inherit ApplicationCommandModule ()
|
type EmptyGlobalCommandToAvoidFamousDuplicateSlashCommandsBug() = inherit ApplicationCommandModule ()
|
||||||
|
|
||||||
@ -12,7 +14,48 @@ type SlotMachine() =
|
|||||||
|
|
||||||
[<SlashCommand("spin", "Want to try your luck?")>]
|
[<SlashCommand("spin", "Want to try your luck?")>]
|
||||||
member this.AttackCommand (ctx : InteractionContext) =
|
member this.AttackCommand (ctx : InteractionContext) =
|
||||||
()
|
async {
|
||||||
|
let sleepTime = 1000
|
||||||
|
let random = Random(System.Guid.NewGuid().GetHashCode())
|
||||||
|
let results = [ random.Next(0, 3) ; random.Next(0, 3) ; random.Next(0, 3)]
|
||||||
|
|
||||||
|
do! ctx.Interaction.CreateResponseAsync(InteractionResponseType.DeferredChannelMessageWithSource)
|
||||||
|
|> Async.AwaitTask
|
||||||
|
|
||||||
|
do! Async.Sleep sleepTime
|
||||||
|
let builder = DiscordFollowupMessageBuilder()
|
||||||
|
let embed = DiscordEmbedBuilder()
|
||||||
|
embed.ImageUrl <- slots.[results.[0]]
|
||||||
|
builder.AddEmbed(embed.Build()) |> ignore
|
||||||
|
do! ctx.Interaction.CreateFollowupMessageAsync(builder)
|
||||||
|
|> Async.AwaitTask
|
||||||
|
|> Async.Ignore
|
||||||
|
|
||||||
|
do! Async.Sleep sleepTime
|
||||||
|
let builder = DiscordFollowupMessageBuilder()
|
||||||
|
embed.ImageUrl <- slots.[results.[1]]
|
||||||
|
builder.AddEmbed(embed.Build()) |> ignore
|
||||||
|
do! ctx.Interaction.CreateFollowupMessageAsync(builder)
|
||||||
|
|> Async.AwaitTask
|
||||||
|
|> Async.Ignore
|
||||||
|
|
||||||
|
do! Async.Sleep sleepTime
|
||||||
|
let builder = DiscordFollowupMessageBuilder()
|
||||||
|
embed.ImageUrl <- slots.[results.[2]]
|
||||||
|
builder.AddEmbed(embed.Build()) |> ignore
|
||||||
|
do! ctx.Interaction.CreateFollowupMessageAsync(builder)
|
||||||
|
|> Async.AwaitTask
|
||||||
|
|> Async.Ignore
|
||||||
|
|
||||||
|
do! Async.Sleep sleepTime
|
||||||
|
let builder = DiscordFollowupMessageBuilder()
|
||||||
|
builder.Content <- "You win!"
|
||||||
|
do! ctx.Interaction.CreateFollowupMessageAsync(builder)
|
||||||
|
|> Async.AwaitTask
|
||||||
|
|> Async.Ignore
|
||||||
|
|
||||||
|
} |> Async.StartAsTask
|
||||||
|
:> Task
|
||||||
|
|
||||||
let config = DiscordConfiguration()
|
let config = DiscordConfiguration()
|
||||||
config.Token <- "OTMyMzQ3NzQ1NDE3NzE1ODE0.YeRqgA.PHandjk0jQGIxlM8NlqKc7cJD3s"
|
config.Token <- "OTMyMzQ3NzQ1NDE3NzE1ODE0.YeRqgA.PHandjk0jQGIxlM8NlqKc7cJD3s"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user