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