Slots improvements, send embeds admin command
This commit is contained in:
parent
ca1f1b269d
commit
0b5ada0e90
21
Bot/Admin.fs
21
Bot/Admin.fs
@ -8,6 +8,11 @@ open DSharpPlus.SlashCommands
|
||||
open DSharpPlus.SlashCommands.Attributes
|
||||
open Degenz.Messaging
|
||||
|
||||
type InitEmbeds =
|
||||
| Dojo = 0
|
||||
| Whitelist = 1
|
||||
| Slots = 2
|
||||
|
||||
let handleGuildDownloadReady (_ : DiscordClient) (event : GuildDownloadCompletedEventArgs) =
|
||||
task {
|
||||
let ( _ , guild ) = event.Guilds.TryGetValue(GuildEnvironment.guildId)
|
||||
@ -19,6 +24,16 @@ let handleGuildDownloadReady (_ : DiscordClient) (event : GuildDownloadCompleted
|
||||
do! guild.BatchEditApplicationCommandPermissionsAsync(commands) |> Async.AwaitTask |> Async.Ignore
|
||||
} :> Task
|
||||
|
||||
let sendEmbed embed (ctx : IDiscordContext) =
|
||||
task {
|
||||
match embed with
|
||||
| InitEmbeds.Dojo -> Trainer.sendInitialEmbed ctx
|
||||
| InitEmbeds.Whitelist -> InviteTracker.sendInitialEmbed ctx
|
||||
| InitEmbeds.Slots -> SlotMachine.sendInitialEmbed ctx
|
||||
| _ -> ()
|
||||
do! Messaging.sendSimpleResponse ctx "Sent!"
|
||||
} :> Task
|
||||
|
||||
type AdminBot() =
|
||||
inherit ApplicationCommandModule ()
|
||||
|
||||
@ -36,3 +51,9 @@ type AdminBot() =
|
||||
[<SlashCommand("admin-whitelist-stock", "Set whitelist stock", false)>]
|
||||
member this.SetStock (ctx : InteractionContext, [<Option("amount", "Set the amount of WL available for purchase")>] amount : int64) =
|
||||
enforceAdmin (DiscordInteractionContext ctx) (InviteTracker.setWhitelistStock (int amount))
|
||||
|
||||
[<SlashCommand("admin-send-embed", "Set whitelist stock", false)>]
|
||||
member this.SendEmbedToChannel (ctx : InteractionContext, [<Option("embed", "Which embed to send")>] embed : InitEmbeds) =
|
||||
enforceAdmin (DiscordInteractionContext ctx) (sendEmbed embed)
|
||||
|
||||
|
||||
|
17
Bot/Bot.fs
17
Bot/Bot.fs
@ -65,7 +65,7 @@ hackerCommands.RegisterCommands<HackerBattle.HackerGame>(guild);
|
||||
storeCommands.RegisterCommands<Store.Store>(guild);
|
||||
stealCommands.RegisterCommands<Thief.StealGame>(guild);
|
||||
inviterCommands.RegisterCommands<InviteTracker.Inviter>(guild);
|
||||
slotsCommands.RegisterCommands<SlotMachine.SlotMachine>(guild);
|
||||
//slotsCommands.RegisterCommands<SlotMachine.SlotMachine>(guild);
|
||||
adminCommands.RegisterCommands<Admin.AdminBot>(guild)
|
||||
|
||||
hackerBattleBot.add_ComponentInteractionCreated(AsyncEventHandler(HackerBattle.handleButtonEvent))
|
||||
@ -93,25 +93,22 @@ let asdf (_ : DiscordClient) (event : DSharpPlus.EventArgs.InteractionCreateEven
|
||||
:> Task
|
||||
//hackerBattleBot.add_InteractionCreated(AsyncEventHandler(asdf))
|
||||
|
||||
slotsBot.ConnectAsync() |> Async.AwaitTask |> Async.RunSynchronously
|
||||
GuildEnvironment.botClientSlots <- Some slotsBot
|
||||
|
||||
hackerBattleBot.ConnectAsync() |> Async.AwaitTask |> Async.RunSynchronously
|
||||
GuildEnvironment.botUserHackerBattle <- Some hackerBattleBot.CurrentUser
|
||||
GuildEnvironment.botClientHacker <- Some hackerBattleBot
|
||||
|
||||
storeBot.ConnectAsync() |> Async.AwaitTask |> Async.RunSynchronously
|
||||
GuildEnvironment.botUserArmory <- Some storeBot.CurrentUser
|
||||
//GuildEnvironment.botClient <- Some storeBot.CurrentUser
|
||||
|
||||
inviterBot.ConnectAsync() |> Async.AwaitTask |> Async.RunSynchronously
|
||||
GuildEnvironment.botClientRecruit <- Some inviterBot
|
||||
|
||||
//slotsBot.ConnectAsync() |> Async.AwaitTask |> Async.RunSynchronously
|
||||
adminBot.ConnectAsync() |> Async.AwaitTask |> Async.RunSynchronously
|
||||
|
||||
//adminBot.ConnectAsync() |> Async.AwaitTask |> Async.RunSynchronously
|
||||
//stealBot.ConnectAsync() |> Async.AwaitTask |> Async.RunSynchronously
|
||||
|
||||
//if guild <> 922419263275425832uL then
|
||||
// Trainer.sendInitialEmbed hackerBattleBot
|
||||
// InviteTracker.sendInitialEmbed inviterBot
|
||||
//SlotMachine.sendInitialEmbed slotsBot
|
||||
|
||||
let rec loop areBotsRunning =
|
||||
async {
|
||||
if not (File.Exists "fsharp-bots") then
|
||||
|
@ -30,6 +30,54 @@
|
||||
<Compile Include="Games\HackerBattle.fs" />
|
||||
<Compile Include="Admin.fs" />
|
||||
<Compile Include="Bot.fs" />
|
||||
<Content Include="..\Images\SlotMachine\new\oldtv.png">
|
||||
<Link>images\oldtv.png</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="..\Images\SlotMachine\new\sushi.png">
|
||||
<Link>images\sushi.png</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="..\Images\SlotMachine\new\aneye.png">
|
||||
<Link>images\aneye.png</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="..\Images\SlotMachine\new\anonmask.png">
|
||||
<Link>images\anonmask.png</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="..\Images\SlotMachine\new\obey.png">
|
||||
<Link>images\obey.png</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="..\Images\SlotMachine\new\circuitboard.png">
|
||||
<Link>images\circuitboard.png</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="..\Images\SlotMachine\new\pills.png">
|
||||
<Link>images\pills.png</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="..\Images\SlotMachine\new\rat.png">
|
||||
<Link>images\rat.png</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="..\Images\SlotMachine\new\ramen.png">
|
||||
<Link>images\ramen.png</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="..\Images\SlotMachine\new\pizza.png">
|
||||
<Link>images\pizza.png</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="..\Images\SlotMachine\new\alcohol.png">
|
||||
<Link>images\alcohol.png</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="..\Images\SlotMachine\new\bigbrother.png">
|
||||
<Link>images\bigbrother.png</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<Import Project="..\.paket\Paket.Restore.targets" />
|
||||
</Project>
|
@ -127,11 +127,11 @@ let getArsenalEmbed (player : PlayerData) =
|
||||
let getAchievementEmbed rewards description achievement =
|
||||
let embed = DiscordEmbedBuilder()
|
||||
|
||||
GuildEnvironment.botUserHackerBattle
|
||||
GuildEnvironment.botClientHacker
|
||||
|> Option.iter (fun bot ->
|
||||
embed.Author <- DiscordEmbedBuilder.EmbedAuthor()
|
||||
embed.Author.Name <- bot.Username
|
||||
embed.Author.IconUrl <- bot.AvatarUrl)
|
||||
embed.Author.Name <- bot.CurrentUser.Username
|
||||
embed.Author.IconUrl <- bot.CurrentUser.AvatarUrl)
|
||||
|
||||
DiscordFollowupMessageBuilder()
|
||||
.AddEmbed(
|
||||
|
@ -10,56 +10,72 @@ open DSharpPlus.SlashCommands
|
||||
open Degenz.Messaging
|
||||
open Degenz.Types
|
||||
|
||||
let slots =
|
||||
// [|
|
||||
// "https://s7.gifyu.com/images/A-bottle-of-pills.png"
|
||||
// "https://s7.gifyu.com/images/an-eye.png"
|
||||
// "https://s7.gifyu.com/images/anon-face-mask.png"
|
||||
// "https://s7.gifyu.com/images/a-piece-of-sushi.png"
|
||||
// "https://s7.gifyu.com/images/Circuit-board.png"
|
||||
// "https://s7.gifyu.com/images/OBEY.png"
|
||||
// "https://s7.gifyu.com/images/old-tv-screen.png"
|
||||
// "https://s7.gifyu.com/images/pizza.png"
|
||||
// "https://s7.gifyu.com/images/ramen.png"
|
||||
// "https://s7.gifyu.com/images/rat.png"
|
||||
//|]
|
||||
// [|
|
||||
// "https://s7.gifyu.com/images/A-bottle-of-pills0a3006d0170e08df.png"
|
||||
// "https://s7.gifyu.com/images/an-eyec362d8152ae2382b.png"
|
||||
// "https://s7.gifyu.com/images/anon-face-mask6c7624821c89fc08.png"
|
||||
// "https://s7.gifyu.com/images/a-piece-of-sushi77071d30f60a89c6.png"
|
||||
// "https://s7.gifyu.com/images/Circuit-board89056017b80f1d13.png"
|
||||
// "https://s7.gifyu.com/images/OBEYf2a8234109836c03.png"
|
||||
// "https://s7.gifyu.com/images/old-tv-screendc6bc9d4b6c1fd65.png"
|
||||
// "https://s7.gifyu.com/images/pizza030ffc00ff50da0e.png"
|
||||
// "https://s7.gifyu.com/images/ramen08336d448018c98f.png"
|
||||
// "https://s7.gifyu.com/images/rat14f65f54f0d75036.png"
|
||||
//|]
|
||||
type SlotSymbols =
|
||||
| Eye
|
||||
| AnonMask
|
||||
| CircuitBoard
|
||||
| Obey
|
||||
| OldTv
|
||||
| Pills
|
||||
| Pizza
|
||||
| Ramen
|
||||
| Rat
|
||||
| Alcohol
|
||||
| BigBrother
|
||||
| Sushi
|
||||
|
||||
[|
|
||||
"<:sushi:>"
|
||||
"<:pizza:>"
|
||||
"<:ramen:>"
|
||||
"<:circuitboard:>"
|
||||
"<:obey:>"
|
||||
"<:pills:>"
|
||||
"<:oldtv:>"
|
||||
"<:rat:>"
|
||||
"<:aneye:>"
|
||||
"<:anon:>"
|
||||
|]
|
||||
let slotsLocal =
|
||||
[|
|
||||
"/home/joe/Development/DegenzGame/Images/SlotMachine/new/A bottle of pills.png"
|
||||
"/home/joe/Development/DegenzGame/Images/SlotMachine/new/a piece of sushi.png"
|
||||
"/home/joe/Development/DegenzGame/Images/SlotMachine/new/an eye.png"
|
||||
"/home/joe/Development/DegenzGame/Images/SlotMachine/new/anon face mask.png"
|
||||
"/home/joe/Development/DegenzGame/Images/SlotMachine/new/Circuit board.png"
|
||||
"/home/joe/Development/DegenzGame/Images/SlotMachine/new/OBEY.png"
|
||||
"/home/joe/Development/DegenzGame/Images/SlotMachine/new/old tv screen.png"
|
||||
"/home/joe/Development/DegenzGame/Images/SlotMachine/new/pizza.png"
|
||||
"/home/joe/Development/DegenzGame/Images/SlotMachine/new/ramen.png"
|
||||
"/home/joe/Development/DegenzGame/Images/SlotMachine/new/rat.png"
|
||||
let slots =
|
||||
[| "https://s7.gifyu.com/images/aneye.png"
|
||||
"https://s7.gifyu.com/images/anonmask.png"
|
||||
"https://s7.gifyu.com/images/circuitboard.png"
|
||||
"https://s7.gifyu.com/images/obey.png"
|
||||
"https://s7.gifyu.com/images/oldtv.png"
|
||||
"https://s7.gifyu.com/images/pills.png"
|
||||
"https://s7.gifyu.com/images/pizza0d47578733961746.png"
|
||||
"https://s7.gifyu.com/images/ramen0515f00869e1f4eb.png"
|
||||
"https://s7.gifyu.com/images/rat69609f842a0eb9f5.png"
|
||||
"https://s7.gifyu.com/images/alcohol.png"
|
||||
"https://s7.gifyu.com/images/bigbrother.png"
|
||||
"https://s7.gifyu.com/images/sushi.png" |]
|
||||
// [| "https://s7.gifyu.com/images/A-bottle-of-pills0a3006d0170e08df.png"
|
||||
// "https://s7.gifyu.com/images/an-eyec362d8152ae2382b.png"
|
||||
// "https://s7.gifyu.com/images/anon-face-mask6c7624821c89fc08.png"
|
||||
// "https://s7.gifyu.com/images/a-piece-of-sushi77071d30f60a89c6.png"
|
||||
// "https://s7.gifyu.com/images/Circuit-board89056017b80f1d13.png"
|
||||
// "https://s7.gifyu.com/images/OBEYf2a8234109836c03.png"
|
||||
// "https://s7.gifyu.com/images/old-tv-screendc6bc9d4b6c1fd65.png"
|
||||
// "https://s7.gifyu.com/images/pizza030ffc00ff50da0e.png"
|
||||
// "https://s7.gifyu.com/images/ramen08336d448018c98f.png"
|
||||
// "https://s7.gifyu.com/images/rat14f65f54f0d75036.png" |]
|
||||
|
||||
let slotEmojis =
|
||||
[| "<:sushi:>"
|
||||
"<:pizza:>"
|
||||
"<:ramen:>"
|
||||
"<:circuitboard:>"
|
||||
"<:obey:>"
|
||||
"<:pills:>"
|
||||
"<:oldtv:>"
|
||||
"<:rat:>"
|
||||
"<:aneye:>"
|
||||
"<:anon:>" |]
|
||||
|
||||
let slotsImages =
|
||||
[| "./images/anonmask.png"
|
||||
"./images/circuitboard.png"
|
||||
"./images/aneye.png"
|
||||
"./images/obey.png"
|
||||
"./images/oldtv.png"
|
||||
"./images/pills.png"
|
||||
"./images/pizza.png"
|
||||
"./images/ramen.png"
|
||||
"./images/rat.png"
|
||||
"./images/bigbrother.png"
|
||||
"./images/alcohol.png"
|
||||
"./images/sushi.png" |]
|
||||
|> Array.map (fun path -> ( Path.GetFileNameWithoutExtension(path) , File.OpenRead(path) ))
|
||||
|
||||
let payTable = [|
|
||||
|]
|
||||
|
||||
let PlayPrice = 10<GBT>
|
||||
@ -67,12 +83,84 @@ let twoOfAKindPrize = 100<GBT>
|
||||
let threeOfAKindPrize = 1000<GBT>
|
||||
let fourOfAKindPrize = 10000<GBT>
|
||||
|
||||
let spin (ctx : IDiscordContext) =
|
||||
PlayerInteractions.executePlayerAction ctx (fun player -> async {
|
||||
let sleepTime = 1000
|
||||
let spinEmbeds (results : int array) (ctx : IDiscordContext) =
|
||||
async {
|
||||
let iCtx = ctx.GetInteraction()
|
||||
|
||||
let builder = DiscordFollowupMessageBuilder()
|
||||
|
||||
builder.Content <- "Spinning!"
|
||||
builder.IsEphemeral <- true
|
||||
|
||||
let e1 = DiscordEmbedBuilder().WithImageUrl(slots.[results[0]])
|
||||
let e2 = DiscordEmbedBuilder().WithImageUrl(slots.[results[1]])
|
||||
let e3 = DiscordEmbedBuilder().WithImageUrl(slots.[results[2]])
|
||||
|
||||
let! followUp = iCtx.CreateFollowupMessageAsync(builder) |> Async.AwaitTask
|
||||
do! Async.Sleep 1000
|
||||
let! _ = iCtx.EditFollowupMessageAsync(followUp.Id, DiscordWebhookBuilder().AddEmbeds([ e1.Build() ])) |> Async.AwaitTask
|
||||
do! Async.Sleep 1000
|
||||
let! _ = iCtx.EditFollowupMessageAsync(followUp.Id, DiscordWebhookBuilder().AddEmbeds([ e1.Build() ; e2.Build() ])) |> Async.AwaitTask
|
||||
do! Async.Sleep 1000
|
||||
let! _ = iCtx.EditFollowupMessageAsync(followUp.Id, DiscordWebhookBuilder().AddEmbeds([ e1.Build() ; e2.Build() ; e3.Build() ])) |> Async.AwaitTask
|
||||
do! Async.Sleep 1000
|
||||
let! _ = iCtx.EditFollowupMessageAsync(followUp.Id, DiscordWebhookBuilder().AddEmbeds([ e1.Build() ; e2.Build() ; e3.Build() ])) |> Async.AwaitTask
|
||||
|
||||
return ()
|
||||
}
|
||||
|
||||
let spinEmojis (results : int array) (ctx : IDiscordContext) =
|
||||
async {
|
||||
let inter = ctx.GetInteraction()
|
||||
let emojis = ctx.GetGuild().Emojis |> Seq.map (fun kvp -> kvp.Value) |> Seq.toArray
|
||||
let builder = DiscordFollowupMessageBuilder()
|
||||
|
||||
builder.Content <- "Spinning!"
|
||||
builder.IsEphemeral <- true
|
||||
let! followUp = inter.CreateFollowupMessageAsync(builder) |> Async.AwaitTask
|
||||
|
||||
do! Async.Sleep 1000
|
||||
let content = $"{Formatter.Emoji(emojis.[results.[0]])}"
|
||||
let! _ = inter.EditFollowupMessageAsync(followUp.Id, DiscordWebhookBuilder().WithContent(content)) |> Async.AwaitTask
|
||||
do! Async.Sleep 1000
|
||||
let content = $"{Formatter.Emoji(emojis.[results.[0]])}{Formatter.Emoji(emojis.[results.[1]])}"
|
||||
let! _ = inter.EditFollowupMessageAsync(followUp.Id, DiscordWebhookBuilder().WithContent(content)) |> Async.AwaitTask
|
||||
do! Async.Sleep 1000
|
||||
let content = $"{Formatter.Emoji(emojis.[results.[0]])}{Formatter.Emoji(emojis.[results.[1]])}{Formatter.Emoji(emojis.[results.[2]])}"
|
||||
let! _ = inter.EditFollowupMessageAsync(followUp.Id, DiscordWebhookBuilder().WithContent(content)) |> Async.AwaitTask
|
||||
return ()
|
||||
}
|
||||
|
||||
let spinFiles (results : int array) (ctx : IDiscordContext) =
|
||||
async {
|
||||
let inter = ctx.GetInteraction()
|
||||
let emojis = ctx.GetGuild().Emojis |> Seq.map (fun kvp -> kvp.Value) |> Seq.toArray
|
||||
let builder = DiscordFollowupMessageBuilder()
|
||||
|
||||
builder.Content <- "Spinning!"
|
||||
builder.IsEphemeral <- true
|
||||
let! followUp = inter.CreateFollowupMessageAsync(builder) |> Async.AwaitTask
|
||||
|
||||
do! Async.Sleep 1000
|
||||
let ( name , stream ) = slotsImages.[results.[0]]
|
||||
let! _ = inter.EditFollowupMessageAsync(followUp.Id, DiscordWebhookBuilder()
|
||||
.AddFile(name + "1.png", stream)) |> Async.AwaitTask
|
||||
do! Async.Sleep 1000
|
||||
let ( name , stream ) = slotsImages.[results.[1]]
|
||||
let! _ = inter.EditFollowupMessageAsync(followUp.Id, DiscordWebhookBuilder()
|
||||
.AddFile(name + "2.png", stream)) |> Async.AwaitTask
|
||||
do! Async.Sleep 1000
|
||||
let ( name , stream ) = slotsImages.[results.[2]]
|
||||
let! _ = inter.EditFollowupMessageAsync(followUp.Id, DiscordWebhookBuilder()
|
||||
.AddFile(name + "3.png", stream)) |> Async.AwaitTask
|
||||
return ()
|
||||
}
|
||||
|
||||
let spin spinType (ctx : IDiscordContext) =
|
||||
PlayerInteractions.executePlayerAction ctx (fun player -> async {
|
||||
let random = Random(System.Guid.NewGuid().GetHashCode())
|
||||
let slotCount = slots.Length
|
||||
let results = [ random.Next(0, slotCount) ; random.Next(0, slotCount) ; random.Next(0, slotCount) ]
|
||||
let results = [| random.Next(0, slotCount) ; random.Next(0, slotCount) ; random.Next(0, slotCount) |]
|
||||
|
||||
let winConditions = (results.[0] = results.[1] && results.[0] = results.[2])
|
||||
|| (results.[0] <> results.[1] && results.[1] <> results.[2] && results.[0] <> results.[2])
|
||||
@ -81,87 +169,50 @@ let spin (ctx : IDiscordContext) =
|
||||
then do! DbService.updatePlayerCurrency twoOfAKindPrize player |> Async.Ignore
|
||||
else do! DbService.updatePlayerCurrency -PlayPrice player |> Async.Ignore
|
||||
|
||||
// let embed1 = DiscordEmbedBuilder()
|
||||
// embed1.ImageUrl <- slots.[results.[0]]
|
||||
// let embed2 = DiscordEmbedBuilder()
|
||||
// embed2.ImageUrl <- slots.[results.[1]]
|
||||
// let embed3 = DiscordEmbedBuilder()
|
||||
// embed3.ImageUrl <- slots.[results.[2]]
|
||||
match spinType with
|
||||
| "Embeds" -> do! spinEmbeds results ctx
|
||||
| "Emojis" -> do! spinEmojis results ctx
|
||||
| "Files" -> do! spinFiles results ctx
|
||||
| _ -> ()
|
||||
|
||||
let embed4 = DiscordEmbedBuilder()
|
||||
embed4.Title <- "Slot Machine"
|
||||
embed4.Description <- "You hit the jackpot!"
|
||||
|
||||
let iCtx = ctx.GetInteraction()
|
||||
// if winConditions then
|
||||
// do! Async.Sleep sleepTime
|
||||
// let builder = DiscordFollowupMessageBuilder()
|
||||
// builder.Content <- "You win 10 GBT!"
|
||||
// do! ctx.FollowUp(builder)
|
||||
// |> Async.AwaitTask
|
||||
// |> Async.Ignore
|
||||
// else
|
||||
// do! Async.Sleep sleepTime
|
||||
// let builder = DiscordFollowupMessageBuilder()
|
||||
// builder.Content <- "You lose 0.5 GBT! Try your luck again!"
|
||||
// do! ctx.FollowUp(builder)
|
||||
// |> Async.AwaitTask
|
||||
// |> Async.Ignore
|
||||
|
||||
let builder = DiscordFollowupMessageBuilder()
|
||||
// let embed = DiscordEmbedBuilder()
|
||||
// embed.ImageUrl <- slots.[results.[0]]
|
||||
// builder.AddEmbed(embed.Build()) |> ignore
|
||||
|
||||
builder.Content <- "Spinning!"
|
||||
builder.IsEphemeral <- true
|
||||
|
||||
let emojis = ctx.GetGuild().Emojis |> Seq.map (fun kvp -> kvp.Value) |> Seq.toArray
|
||||
|
||||
|
||||
let! followUp = iCtx.CreateFollowupMessageAsync(builder) |> Async.AwaitTask
|
||||
do! Async.Sleep 1500
|
||||
let! _ = iCtx.EditFollowupMessageAsync(followUp.Id, DiscordWebhookBuilder().WithContent(Formatter.Emoji(emojis.[results.[0]]))) |> Async.AwaitTask
|
||||
do! Async.Sleep 1500
|
||||
let! _ = iCtx.EditFollowupMessageAsync(followUp.Id, DiscordWebhookBuilder().WithContent($"{Formatter.Emoji(emojis.[results.[0]])}{Formatter.Emoji(emojis.[results.[1]])}")) |> Async.AwaitTask
|
||||
do! Async.Sleep 1500
|
||||
let! asdf = iCtx.EditFollowupMessageAsync(followUp.Id, DiscordWebhookBuilder()
|
||||
.WithContent($"{Formatter.Emoji(emojis.[results.[0]])}{Formatter.Emoji(emojis.[results.[1]])}{Formatter.Emoji(emojis.[results.[2]])}")
|
||||
.AddEmbed(embed4)
|
||||
) |> Async.AwaitTask
|
||||
do! Async.Sleep 1500
|
||||
|
||||
let builder = DiscordFollowupMessageBuilder()
|
||||
builder.AddEmbeds([ embed4.Build() ]) |> ignore
|
||||
builder.IsEphemeral <- true
|
||||
// let! _ = iCtx.CreateFollowupMessageAsync(builder) |> Async.AwaitTask
|
||||
return ()
|
||||
|
||||
// if winConditions then
|
||||
// do! Async.Sleep sleepTime
|
||||
// let builder = DiscordFollowupMessageBuilder()
|
||||
// builder.Content <- "You win 10 GBT!"
|
||||
// do! ctx.FollowUp(builder)
|
||||
// |> Async.AwaitTask
|
||||
// |> Async.Ignore
|
||||
// else
|
||||
// do! Async.Sleep sleepTime
|
||||
// let builder = DiscordFollowupMessageBuilder()
|
||||
// builder.Content <- "You lose 0.5 GBT! Try your luck again!"
|
||||
// do! ctx.FollowUp(builder)
|
||||
// |> Async.AwaitTask
|
||||
// |> Async.Ignore
|
||||
})
|
||||
|
||||
let handleSpin (_ : DiscordClient) (event : ComponentInteractionCreateEventArgs) =
|
||||
let ctx = DiscordEventContext event
|
||||
task {
|
||||
do! spin (DiscordEventContext event)
|
||||
match event.Id with
|
||||
| "spin-embeds" -> do! spin "Embeds" ctx
|
||||
| "spin-emojis" -> do! spin "Emojis" ctx
|
||||
| "spin-files" -> do! spin "Files" ctx
|
||||
| _ ->
|
||||
printfn "Wrong Spin ID"
|
||||
return ()
|
||||
} :> Task
|
||||
|
||||
let spinCommand (ctx : IDiscordContext) =
|
||||
let sendInitialEmbed (ctx : IDiscordContext) =
|
||||
async {
|
||||
try
|
||||
let builder = DiscordInteractionResponseBuilder()
|
||||
builder.Content <- "The message"
|
||||
builder.IsEphemeral <- true
|
||||
let button = DiscordButtonComponent(ButtonStyle.Success, $"spin", $"Spin Me Right Around") :> DiscordComponent
|
||||
builder.AddComponents [| button |] |> ignore
|
||||
do! ctx.Respond(InteractionResponseType.ChannelMessageWithSource, builder)
|
||||
|> Async.AwaitTask
|
||||
|> Async.Ignore
|
||||
with e ->
|
||||
printfn $"Error trying to get channel Casino\n\n{e.Message}"
|
||||
} |> Async.StartAsTask :> Task
|
||||
|
||||
let sendInitialEmbed (client : DiscordClient) =
|
||||
async {
|
||||
try
|
||||
let! channel = client.GetChannelAsync(961472561319903352uL) |> Async.AwaitTask
|
||||
let channel = ctx.GetGuild().GetChannel(GuildEnvironment.channelSlots)
|
||||
let builder = DiscordMessageBuilder()
|
||||
let embed = DiscordEmbedBuilder()
|
||||
embed.Title <- "Degenz Slot Machine"
|
||||
@ -170,29 +221,31 @@ let sendInitialEmbed (client : DiscordClient) =
|
||||
|
||||
builder.AddEmbed(embed) |> ignore
|
||||
|
||||
let button = DiscordButtonComponent(ButtonStyle.Success, $"spin", $"Spin Me Right Around") :> DiscordComponent
|
||||
builder.AddComponents [| button |] |> ignore
|
||||
do! channel.SendMessageAsync(builder)
|
||||
let button1 = DiscordButtonComponent(ButtonStyle.Success, $"spin-embeds", $"Spin Embeds 1 $GBT") :> DiscordComponent
|
||||
let button2 = DiscordButtonComponent(ButtonStyle.Success, $"spin-emojis", $"Spin Emojis 5 $GBT") :> DiscordComponent
|
||||
let button3 = DiscordButtonComponent(ButtonStyle.Success, $"spin-files", $"Spin Files 10 $GBT") :> DiscordComponent
|
||||
builder.AddComponents [| button1 ; button2 ; button3 |] |> ignore
|
||||
do! GuildEnvironment.botClientSlots.Value.SendMessageAsync(channel, builder)
|
||||
|> Async.AwaitTask
|
||||
|> Async.Ignore
|
||||
with e ->
|
||||
printfn $"Error trying to get channel Training Dojo\n\n{e.Message}"
|
||||
} |> Async.RunSynchronously
|
||||
|
||||
type SlotMachine() =
|
||||
inherit ApplicationCommandModule ()
|
||||
|
||||
let enforceChannel (ctx : IDiscordContext) (spinFn : IDiscordContext -> Task) =
|
||||
match ctx.GetChannel().Id with
|
||||
| id when id = 961472561319903352uL -> spinFn ctx
|
||||
| _ ->
|
||||
task {
|
||||
let msg = $"You must go to <#961472561319903352> channel to spin"
|
||||
do! Messaging.sendSimpleResponse ctx msg
|
||||
}
|
||||
|
||||
[<SlashCommand("spin", "Want to try your luck?")>]
|
||||
member this.Spin (ctx : InteractionContext) = enforceChannel (DiscordInteractionContext ctx) spinCommand
|
||||
|
||||
[<SlashCommand("spin-simple", "Want to try your luck?")>]
|
||||
member this.SpinSimple (ctx : InteractionContext) = enforceChannel (DiscordInteractionContext ctx) spin
|
||||
//type SlotMachine() =
|
||||
// inherit ApplicationCommandModule ()
|
||||
//
|
||||
// let enforceChannel (ctx : IDiscordContext) (spinFn : IDiscordContext -> Task) =
|
||||
// match ctx.GetChannel().Id with
|
||||
// | id when id = GuildEnvironment.channelSlots -> spinFn ctx
|
||||
// | _ ->
|
||||
// task {
|
||||
// let msg = $"You must go to <#{GuildEnvironment.channelSlots}> channel to play the slots!"
|
||||
// do! Messaging.sendSimpleResponse ctx msg
|
||||
// }
|
||||
//
|
||||
// [<SlashCommand("spin", "Want to try your luck?")>]
|
||||
// member this.Spin (ctx : InteractionContext) = enforceChannel (DiscordInteractionContext ctx) spinCommand
|
||||
//
|
||||
// [<SlashCommand("spin-simple", "Want to try your luck?")>]
|
||||
// member this.SpinSimple (ctx : InteractionContext) = enforceChannel (DiscordInteractionContext ctx) spin
|
||||
|
@ -36,10 +36,10 @@ let ShieldEvents () = [
|
||||
Type = Shielding (int ItemId.Cypher) }
|
||||
]
|
||||
|
||||
let sendInitialEmbed (client : DiscordClient) =
|
||||
let sendInitialEmbed (ctx : IDiscordContext) =
|
||||
async {
|
||||
try
|
||||
let! channel = client.GetChannelAsync(GuildEnvironment.channelTraining) |> Async.AwaitTask
|
||||
let channel = ctx.GetGuild().GetChannel(GuildEnvironment.channelTraining)
|
||||
let builder = DiscordMessageBuilder()
|
||||
let embed = DiscordEmbedBuilder()
|
||||
embed.ImageUrl <- "https://s10.gifyu.com/images/MasterTraining_Degenz.gif"
|
||||
@ -49,7 +49,7 @@ let sendInitialEmbed (client : DiscordClient) =
|
||||
+ "Are you ready?"
|
||||
let button = DiscordButtonComponent(ButtonStyle.Success, $"Trainer-1", $"LFG") :> DiscordComponent
|
||||
builder.AddComponents [| button |] |> ignore
|
||||
do! channel.SendMessageAsync(builder)
|
||||
do! GuildEnvironment.botClientHacker.Value.SendMessageAsync(channel, builder)
|
||||
|> Async.AwaitTask
|
||||
|> Async.Ignore
|
||||
with e ->
|
||||
|
@ -48,7 +48,6 @@ let roleHacker = getId "ROLE_HACKER"
|
||||
let rolePrisoner = getId "ROLE_PRISONER"
|
||||
let roleWhitelist = getId "ROLE_WHITELIST"
|
||||
let roleAdmin = getId "ROLE_ADMIN"
|
||||
|
||||
let mutable botUserHackerBattle : DiscordUser option = None
|
||||
let mutable botUserArmory : DiscordUser option = None
|
||||
let mutable botClientRecruit : DiscordClient option = None
|
||||
let mutable botClientHacker : DiscordClient option = None
|
||||
let mutable botClientSlots : DiscordClient option = None
|
||||
|
@ -318,10 +318,10 @@ let acceptInvite (ctx : IDiscordContext) (invitedPlayer : PlayerData) =
|
||||
| true -> return ()
|
||||
} :> Task
|
||||
|
||||
let sendInitialEmbed (client : DiscordClient) =
|
||||
let sendInitialEmbed (ctx : IDiscordContext) =
|
||||
async {
|
||||
try
|
||||
let! channel = client.GetChannelAsync(GuildEnvironment.channelWhitelist) |> Async.AwaitTask
|
||||
let channel = ctx.GetGuild().GetChannel(GuildEnvironment.channelWhitelist)
|
||||
let builder = DiscordMessageBuilder()
|
||||
let embed = DiscordEmbedBuilder()
|
||||
embed.ImageUrl <- "https://s1.gifyu.com/images/whitelist-image-2.gif"
|
||||
@ -337,7 +337,8 @@ Your NFT will be your In-Game Character that provides you with unique traits, an
|
||||
builder.AddEmbed embed |> ignore
|
||||
let button = DiscordButtonComponent(ButtonStyle.Success, $"GimmeWhitelist", $"Give Me Whitelist") :> DiscordComponent
|
||||
builder.AddComponents [| button |] |> ignore
|
||||
do! channel.SendMessageAsync(builder)
|
||||
|
||||
do! GuildEnvironment.botClientRecruit.Value.SendMessageAsync(channel, builder)
|
||||
|> Async.AwaitTask
|
||||
|> Async.Ignore
|
||||
with e ->
|
||||
@ -538,36 +539,30 @@ let handleCreateInvite (ctx : IDiscordContext) =
|
||||
|
||||
let! code =
|
||||
task {
|
||||
printfn "1"
|
||||
let! invites = getInvitesFromUser user.Id
|
||||
printfn "2"
|
||||
match invites |> Map.toList with
|
||||
| [] ->
|
||||
printfn "3"
|
||||
let channel = ctx.GetGuild().Channels.[GuildEnvironment.channelWelcome]
|
||||
printfn "4"
|
||||
let! invite = channel.CreateInviteAsync(max_age = 0, unique = true)
|
||||
printfn "5"
|
||||
let ( result , channel ) = ctx.GetGuild().Channels.TryGetValue(GuildEnvironment.channelWelcome)
|
||||
if result then
|
||||
let! invite = channel.CreateInviteAsync(max_age = 0, unique = true)
|
||||
|
||||
try do! createInvite (ctx.GetDiscordMember().Id) invite.Code |> Async.Ignore
|
||||
with ex -> printfn "%A" ex.Message
|
||||
printfn "6"
|
||||
try do! createInvite (ctx.GetDiscordMember().Id) invite.Code |> Async.Ignore
|
||||
with ex -> printfn "%A" ex.Message
|
||||
|
||||
return invite.Code
|
||||
return invite.Code
|
||||
else
|
||||
printfn "Error finding Welcome channel"
|
||||
return ""
|
||||
| invite::_ ->
|
||||
printfn "-1"
|
||||
return invite |> fst
|
||||
}
|
||||
|
||||
printfn "7"
|
||||
let msg =
|
||||
DiscordFollowupMessageBuilder()
|
||||
.WithContent($"https://discord.gg/{code}")
|
||||
.AsEphemeral(true)
|
||||
|
||||
printfn "8"
|
||||
do! ctx.FollowUp(msg)
|
||||
printfn "9"
|
||||
do! Analytics.recruitLinkButton code user.Id user.Username (ctx.GetChannel())
|
||||
} :> Task
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user