Move bots into single process
This commit is contained in:
parent
bcb99d9a78
commit
fd9a6a25f3
@ -1,7 +1,7 @@
|
||||
module DegenzGame.DbService
|
||||
module Degenz.DbService
|
||||
|
||||
open System
|
||||
open DegenzGame.Shared
|
||||
open Degenz.Shared
|
||||
open MongoDB.Bson
|
||||
open MongoDB.Driver
|
||||
|
||||
|
@ -3,19 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30114.105
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "HackerBattle", "HackerBattle\HackerBattle.fsproj", "{2A437756-3D5D-467D-9497-DF9789DB99CC}"
|
||||
EndProject
|
||||
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Shared", "Shared\Shared.fsproj", "{5F34C24E-BA4E-4E57-9141-812775687360}"
|
||||
EndProject
|
||||
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Store", "Store\Store.fsproj", "{CD88B0A6-DE42-4087-9B33-48FF84201633}"
|
||||
EndProject
|
||||
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "PlayerInteractions", "PlayerInteractions\PlayerInteractions.fsproj", "{FF9E58A6-1A1D-4DEC-B52D-265F215BF315}"
|
||||
EndProject
|
||||
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "DbService", "DbService\DbService.fsproj", "{B1D3E1CC-451C-42D4-B054-D64E75E1A3B9}"
|
||||
EndProject
|
||||
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "SlotMachine", "SlotMachine\SlotMachine.fsproj", "{3183BE8D-1CA6-4768-8606-BEF6F4EC8DE1}"
|
||||
EndProject
|
||||
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Trainer", "Trainer\Trainer.fsproj", "{2511151A-EC5A-4BF9-A3EA-EF996AC2A4F1}"
|
||||
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Shared", "Shared\Shared.fsproj", "{BD80E85E-87C8-4F5F-941E-7DCAF9D69838}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@ -26,18 +18,6 @@ Global
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{2A437756-3D5D-467D-9497-DF9789DB99CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2A437756-3D5D-467D-9497-DF9789DB99CC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2A437756-3D5D-467D-9497-DF9789DB99CC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2A437756-3D5D-467D-9497-DF9789DB99CC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{5F34C24E-BA4E-4E57-9141-812775687360}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5F34C24E-BA4E-4E57-9141-812775687360}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5F34C24E-BA4E-4E57-9141-812775687360}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5F34C24E-BA4E-4E57-9141-812775687360}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{CD88B0A6-DE42-4087-9B33-48FF84201633}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CD88B0A6-DE42-4087-9B33-48FF84201633}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CD88B0A6-DE42-4087-9B33-48FF84201633}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CD88B0A6-DE42-4087-9B33-48FF84201633}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{FF9E58A6-1A1D-4DEC-B52D-265F215BF315}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{FF9E58A6-1A1D-4DEC-B52D-265F215BF315}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FF9E58A6-1A1D-4DEC-B52D-265F215BF315}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
@ -46,13 +26,9 @@ Global
|
||||
{B1D3E1CC-451C-42D4-B054-D64E75E1A3B9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B1D3E1CC-451C-42D4-B054-D64E75E1A3B9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B1D3E1CC-451C-42D4-B054-D64E75E1A3B9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3183BE8D-1CA6-4768-8606-BEF6F4EC8DE1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3183BE8D-1CA6-4768-8606-BEF6F4EC8DE1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3183BE8D-1CA6-4768-8606-BEF6F4EC8DE1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3183BE8D-1CA6-4768-8606-BEF6F4EC8DE1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2511151A-EC5A-4BF9-A3EA-EF996AC2A4F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2511151A-EC5A-4BF9-A3EA-EF996AC2A4F1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2511151A-EC5A-4BF9-A3EA-EF996AC2A4F1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2511151A-EC5A-4BF9-A3EA-EF996AC2A4F1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{BD80E85E-87C8-4F5F-941E-7DCAF9D69838}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BD80E85E-87C8-4F5F-941E-7DCAF9D69838}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BD80E85E-87C8-4F5F-941E-7DCAF9D69838}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BD80E85E-87C8-4F5F-941E-7DCAF9D69838}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
@ -1,49 +0,0 @@
|
||||
open System.Threading.Tasks
|
||||
open DSharpPlus
|
||||
open DSharpPlus.Entities
|
||||
open DSharpPlus.SlashCommands
|
||||
open Emzi0767.Utilities
|
||||
open DegenzGame
|
||||
open DegenzGame.Commands
|
||||
|
||||
type EmptyGlobalCommandToAvoidFamousDuplicateSlashCommandsBug() = inherit ApplicationCommandModule ()
|
||||
|
||||
type HackerGame() =
|
||||
inherit ApplicationCommandModule ()
|
||||
|
||||
[<SlashCommand("hack", "Send a hack attack to another player")>]
|
||||
member this.AttackCommand (ctx : InteractionContext, [<Option("target", "The player you want to hack")>] target : DiscordUser) =
|
||||
Commands.attack ctx target
|
||||
|
||||
[<SlashCommand("defend", "Create a passive defense that will last 24 hours")>]
|
||||
member this.DefendCommand (ctx : InteractionContext) = Commands.defend ctx
|
||||
|
||||
let config = DiscordConfiguration()
|
||||
config.Token <- "OTMyMzI5NDAzNjYzNDEzMjQ4.YeRZaw.ZyCo5L8HFsCvx8JuhdAwqrH3hZI"
|
||||
config.TokenType <- TokenType.Bot
|
||||
config.Intents <- DiscordIntents.All
|
||||
//config.MinimumLogLevel <- Microsoft.Extensions.Logging.LogLevel.Trace
|
||||
|
||||
let client = new DiscordClient(config)
|
||||
|
||||
client.add_ComponentInteractionCreated(AsyncEventHandler(handleButtonEvent))
|
||||
|
||||
let slash = client.UseSlashCommands()
|
||||
|
||||
// My server
|
||||
slash.RegisterCommands<HackerGame>(922419263275425832uL);
|
||||
// Degenz
|
||||
//slash.RegisterCommands<HackerGame>(922414052708327494uL);
|
||||
|
||||
client.ConnectAsync ()
|
||||
|> Async.AwaitTask
|
||||
|> Async.RunSynchronously
|
||||
|
||||
Task.Delay(-1)
|
||||
|> Async.AwaitTask
|
||||
|> Async.RunSynchronously
|
||||
|
||||
client.DisconnectAsync ()
|
||||
|> Async.AwaitTask
|
||||
|> Async.RunSynchronously
|
||||
|
@ -14,8 +14,6 @@
|
||||
<ReferencePathWithRefAssemblies Update="\home\joe\.nuget\packages\dsharpplus.slashcommands\4.2.0-nightly-01054\lib\netstandard2.0\DSharpPlus.SlashCommands.dll" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Commands.fs" />
|
||||
<Compile Include="HackerBattle.fs" />
|
||||
<Content Include="paket.references" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
74
PlayerInteractions/Bot.fs
Normal file
74
PlayerInteractions/Bot.fs
Normal file
@ -0,0 +1,74 @@
|
||||
module Degenz.Bot
|
||||
|
||||
open System.Threading.Tasks
|
||||
open DSharpPlus
|
||||
open DSharpPlus.SlashCommands
|
||||
open Degenz.Shared
|
||||
open Emzi0767.Utilities
|
||||
open Degenz.PlayerInteractions
|
||||
open Degenz.SlotMachine
|
||||
open Degenz.Trainer
|
||||
open Degenz.HackerBattle
|
||||
open Degenz.Store
|
||||
|
||||
|
||||
type EmptyGlobalCommandToAvoidFamousDuplicateSlashCommandsBug() = inherit ApplicationCommandModule ()
|
||||
|
||||
let playerInteractionsConfig = DiscordConfiguration()
|
||||
let trainerConfig = DiscordConfiguration()
|
||||
let hackerBattleConfig = DiscordConfiguration()
|
||||
let storeConfig = DiscordConfiguration()
|
||||
let slotMachineConfig = DiscordConfiguration()
|
||||
|
||||
let configs = [| playerInteractionsConfig ; trainerConfig ; hackerBattleConfig ; storeConfig ; slotMachineConfig ; |]
|
||||
|
||||
for conf in configs do
|
||||
conf.TokenType <- TokenType.Bot
|
||||
conf.Intents <- DiscordIntents.All
|
||||
|
||||
playerInteractionsConfig.Token <- "OTIyNDIyMDIyMTI1MDEwOTU1.YcBOcw.JxfW1CSIwEO7j6RbRFCnPZ-HoTk"
|
||||
trainerConfig.Token <- "OTMzMDg4MTQyNDM5ODk5MTg4.YeccDQ.AbysjlHICgbNQVyduG6aGIHNpdE"
|
||||
hackerBattleConfig.Token <- "OTMyMzI5NDAzNjYzNDEzMjQ4.YeRZaw.ZyCo5L8HFsCvx8JuhdAwqrH3hZI"
|
||||
storeConfig.Token <- "OTMyMzA3NTE0ODc4NDg4NjY2.YeRFCA.3NXX4tLObXU3rVgPt8D1fE58FnY"
|
||||
slotMachineConfig.Token <- "OTMyMzQ3NzQ1NDE3NzE1ODE0.YeRqgA.PHandjk0jQGIxlM8NlqKc7cJD3s"
|
||||
|
||||
//config.MinimumLogLevel <- Microsoft.Extensions.Logging.LogLevel.Trace
|
||||
|
||||
let playerInteractionsBot = new DiscordClient(playerInteractionsConfig)
|
||||
let trainerBot = new DiscordClient(trainerConfig)
|
||||
let hackerBattleBot = new DiscordClient(hackerBattleConfig)
|
||||
let storeBot = new DiscordClient(storeConfig)
|
||||
let slotMachineBot = new DiscordClient(slotMachineConfig)
|
||||
|
||||
let clients = [| playerInteractionsBot ; trainerBot ; hackerBattleBot ; storeBot ; slotMachineBot |]
|
||||
let slashCommands =
|
||||
clients
|
||||
|> Array.map (fun c -> c.UseSlashCommands())
|
||||
|
||||
// My server
|
||||
let joeServer = 922419263275425832uL
|
||||
slashCommands.[0].RegisterCommands<PlayerInteractions>(joeServer);
|
||||
slashCommands.[1].RegisterCommands<Trainer>(joeServer);
|
||||
slashCommands.[2].RegisterCommands<HackerGame>(joeServer);
|
||||
slashCommands.[3].RegisterCommands<Store>(joeServer);
|
||||
slashCommands.[4].RegisterCommands<SlotMachine>(joeServer);
|
||||
// Degenz
|
||||
//slash.RegisterCommands<HackerGame>(922414052708327494uL);
|
||||
|
||||
let run (client : DiscordClient) =
|
||||
async {
|
||||
do! client.ConnectAsync () |> Async.AwaitTask
|
||||
}
|
||||
|
||||
clients
|
||||
|> Array.map run
|
||||
|> Array.toSeq
|
||||
|> Async.Parallel
|
||||
|> Async.RunSynchronously
|
||||
|> ignore
|
||||
|
||||
Task.Delay(-1)
|
||||
|> Async.AwaitTask
|
||||
|> Async.RunSynchronously
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
module DegenzGame.Commands
|
||||
module Degenz.HackerBattle
|
||||
|
||||
open System
|
||||
open System.Threading.Tasks
|
||||
@ -6,7 +6,9 @@ open DSharpPlus
|
||||
open DSharpPlus.Entities
|
||||
open DSharpPlus.EventArgs
|
||||
open DSharpPlus.SlashCommands
|
||||
open DegenzGame.Shared
|
||||
open Degenz
|
||||
open Emzi0767.Utilities
|
||||
open Degenz.Shared
|
||||
|
||||
[<Literal>]
|
||||
// Degenz Server
|
||||
@ -201,3 +203,15 @@ let handleButtonEvent (_ : DiscordClient) (event : ComponentInteractionCreateEve
|
||||
}
|
||||
} |> Async.StartAsTask
|
||||
:> Task
|
||||
|
||||
type HackerGame() =
|
||||
inherit ApplicationCommandModule ()
|
||||
|
||||
[<SlashCommand("hack", "Send a hack attack to another player")>]
|
||||
member this.AttackCommand (ctx : InteractionContext, [<Option("target", "The player you want to hack")>] target : DiscordUser) =
|
||||
attack ctx target
|
||||
|
||||
[<SlashCommand("defend", "Create a passive defense that will last 24 hours")>]
|
||||
member this.DefendCommand (ctx : InteractionContext) = defend ctx
|
||||
|
||||
|
62
PlayerInteractions/Items.json
Normal file
62
PlayerInteractions/Items.json
Normal file
@ -0,0 +1,62 @@
|
||||
[
|
||||
{
|
||||
"Name" : "Virus",
|
||||
"ItemType" : { "Case" : "Weapon" },
|
||||
"Cost" : 5.0
|
||||
},
|
||||
{
|
||||
"Name" : "Ransom",
|
||||
"ItemType" : { "Case" : "Weapon" },
|
||||
"Cost" : 10.0
|
||||
},
|
||||
{
|
||||
"Name" : "Worm",
|
||||
"ItemType" : { "Case" : "Weapon" },
|
||||
"Cost" : 5.0
|
||||
},
|
||||
{
|
||||
"Name" : "DDos",
|
||||
"ItemType" : { "Case" : "Weapon" },
|
||||
"Cost" : 10.0
|
||||
},
|
||||
{
|
||||
"Name" : "Crack",
|
||||
"ItemType" : { "Case" : "Weapon" },
|
||||
"Cost" : 5.0
|
||||
},
|
||||
{
|
||||
"Name" : "Injection",
|
||||
"ItemType" : { "Case" : "Weapon" },
|
||||
"Cost" : 10.0
|
||||
},
|
||||
{
|
||||
"Name" : "Firewall",
|
||||
"ItemType" : { "Case" : "Shield" },
|
||||
"Cost" : 5.0
|
||||
},
|
||||
{
|
||||
"Name" : "PortScan",
|
||||
"ItemType" : { "Case" : "Shield" },
|
||||
"Cost" : 10.0
|
||||
},
|
||||
{
|
||||
"Name" : "Encryption",
|
||||
"ItemType" : { "Case" : "Shield" },
|
||||
"Cost" : 5.0
|
||||
},
|
||||
{
|
||||
"Name" : "Hardening",
|
||||
"ItemType" : { "Case" : "Shield" },
|
||||
"Cost" : 10.0
|
||||
},
|
||||
{
|
||||
"Name" : "Cypher",
|
||||
"ItemType" : { "Case" : "Shield" },
|
||||
"Cost" : 5.0
|
||||
},
|
||||
{
|
||||
"Name" : "Sanitation",
|
||||
"ItemType" : { "Case" : "Shield" },
|
||||
"Cost" : 10.0
|
||||
}
|
||||
]
|
@ -1,10 +1,13 @@
|
||||
module Degenz.PlayerInteractions
|
||||
|
||||
open System
|
||||
open System.Threading.Tasks
|
||||
open DSharpPlus.Entities
|
||||
open DSharpPlus
|
||||
open DSharpPlus.EventArgs
|
||||
open DSharpPlus.SlashCommands
|
||||
open DegenzGame
|
||||
open DegenzGame.Shared
|
||||
open Degenz
|
||||
open Degenz.Shared
|
||||
|
||||
module Commands =
|
||||
let newPlayer nickname (membr : uint64) =
|
||||
@ -109,9 +112,7 @@ module Commands =
|
||||
} |> Async.StartAsTask
|
||||
:> Task
|
||||
|
||||
type EmptyGlobalCommandToAvoidFamousDuplicateSlashCommandsBug() = inherit ApplicationCommandModule ()
|
||||
|
||||
type PlayerRegistration() =
|
||||
type PlayerInteractions() =
|
||||
inherit ApplicationCommandModule ()
|
||||
|
||||
[<SlashCommand("redpill", "Take the redpill and become a hacker")>]
|
||||
@ -127,30 +128,3 @@ type PlayerRegistration() =
|
||||
member this.Leaderboard (ctx : InteractionContext) = Commands.leaderboard ctx
|
||||
|
||||
|
||||
let config = DiscordConfiguration()
|
||||
config.Token <- "OTIyNDIyMDIyMTI1MDEwOTU1.YcBOcw.JxfW1CSIwEO7j6RbRFCnPZ-HoTk"
|
||||
config.TokenType <- TokenType.Bot
|
||||
config.Intents <- DiscordIntents.All
|
||||
//config.MinimumLogLevel <- Microsoft.Extensions.Logging.LogLevel.Trace
|
||||
|
||||
let client = new DiscordClient(config)
|
||||
|
||||
let slash = client.UseSlashCommands()
|
||||
|
||||
// My server
|
||||
slash.RegisterCommands<PlayerRegistration>(922419263275425832uL);
|
||||
// Degenz
|
||||
//slash.RegisterCommands<HackerGame>(922414052708327494uL);
|
||||
|
||||
client.ConnectAsync ()
|
||||
|> Async.AwaitTask
|
||||
|> Async.RunSynchronously
|
||||
|
||||
Task.Delay(-1)
|
||||
|> Async.AwaitTask
|
||||
|> Async.RunSynchronously
|
||||
|
||||
client.DisconnectAsync ()
|
||||
|> Async.AwaitTask
|
||||
|> Async.RunSynchronously
|
||||
|
||||
|
@ -6,17 +6,22 @@
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<RootNamespace>PlayerRegistration</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="PlayerInteractions.fs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include=".dockerignore" />
|
||||
<Content Include="Dockerfile" />
|
||||
<Content Include="paket.references" />
|
||||
<Content Include="Dockerfile" />
|
||||
<Compile Include="Store.fs" />
|
||||
<Compile Include="HackerBattle.fs" />
|
||||
<Compile Include="SlotMachine.fs" />
|
||||
<Compile Include="Trainer.fs" />
|
||||
<Compile Include="PlayerInteractions.fs" />
|
||||
<Compile Include="Bot.fs" />
|
||||
<Content Include="Items.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DbService\DbService.fsproj" />
|
||||
<ProjectReference Include="..\Shared\Shared.fsproj" />
|
||||
</ItemGroup>
|
||||
<Import Project="..\.paket\Paket.Restore.targets" />
|
||||
</Project>
|
@ -1,15 +1,14 @@
|
||||
module Degenz.SlotMachine
|
||||
|
||||
open System
|
||||
open System.Threading.Tasks
|
||||
open DSharpPlus
|
||||
open DSharpPlus.Entities
|
||||
open DSharpPlus.SlashCommands
|
||||
open DegenzGame
|
||||
open DegenzGame.Shared
|
||||
open Degenz.Shared
|
||||
|
||||
let slots = [| "https://i.ibb.co/pKqZdr7/cherry.png" ; "https://i.ibb.co/JnghQsL/lemon.jpg" ; "https://i.ibb.co/1JTFPSs/seven.png" |]
|
||||
|
||||
type EmptyGlobalCommandToAvoidFamousDuplicateSlashCommandsBug() = inherit ApplicationCommandModule ()
|
||||
|
||||
type SlotMachine() =
|
||||
inherit ApplicationCommandModule ()
|
||||
|
||||
@ -79,31 +78,3 @@ type SlotMachine() =
|
||||
|
||||
} |> Async.StartAsTask
|
||||
:> Task
|
||||
|
||||
let config = DiscordConfiguration()
|
||||
config.Token <- "OTMyMzQ3NzQ1NDE3NzE1ODE0.YeRqgA.PHandjk0jQGIxlM8NlqKc7cJD3s"
|
||||
config.TokenType <- TokenType.Bot
|
||||
config.Intents <- DiscordIntents.All
|
||||
//config.MinimumLogLevel <- Microsoft.Extensions.Logging.LogLevel.Trace
|
||||
|
||||
let client = new DiscordClient(config)
|
||||
|
||||
let slash = client.UseSlashCommands()
|
||||
|
||||
// My server
|
||||
slash.RegisterCommands<SlotMachine>(922419263275425832uL);
|
||||
// Degenz
|
||||
//slash.RegisterCommands<HackerGame>(922414052708327494uL);
|
||||
|
||||
client.ConnectAsync ()
|
||||
|> Async.AwaitTask
|
||||
|> Async.RunSynchronously
|
||||
|
||||
Task.Delay(-1)
|
||||
|> Async.AwaitTask
|
||||
|> Async.RunSynchronously
|
||||
|
||||
client.DisconnectAsync ()
|
||||
|> Async.AwaitTask
|
||||
|> Async.RunSynchronously
|
||||
|
@ -1,11 +1,12 @@
|
||||
open System
|
||||
module Degenz.Store
|
||||
|
||||
open System.Threading.Tasks
|
||||
open DSharpPlus.Entities
|
||||
open DSharpPlus
|
||||
open DSharpPlus.EventArgs
|
||||
open DSharpPlus.SlashCommands
|
||||
open DegenzGame
|
||||
open DegenzGame.Shared
|
||||
open Degenz
|
||||
open Degenz.Shared
|
||||
open Emzi0767.Utilities
|
||||
open Newtonsoft.Json
|
||||
|
||||
@ -175,8 +176,6 @@ module Commands =
|
||||
} |> Async.StartAsTask
|
||||
:> Task
|
||||
|
||||
type EmptyGlobalCommandToAvoidFamousDuplicateSlashCommandsBug() = inherit ApplicationCommandModule ()
|
||||
|
||||
type Store() =
|
||||
inherit ApplicationCommandModule ()
|
||||
|
||||
@ -195,32 +194,3 @@ type Store() =
|
||||
member this.SellItem (ctx : InteractionContext) =
|
||||
Commands.sellItem ctx
|
||||
|
||||
let config = DiscordConfiguration()
|
||||
config.Token <- "OTMyMzA3NTE0ODc4NDg4NjY2.YeRFCA.3NXX4tLObXU3rVgPt8D1fE58FnY"
|
||||
config.TokenType <- TokenType.Bot
|
||||
config.Intents <- DiscordIntents.All
|
||||
//config.MinimumLogLevel <- Microsoft.Extensions.Logging.LogLevel.Trace
|
||||
|
||||
let client = new DiscordClient(config)
|
||||
|
||||
client.add_ComponentInteractionCreated(AsyncEventHandler(Commands.handleSellButtonEvents))
|
||||
|
||||
let slash = client.UseSlashCommands()
|
||||
|
||||
// My server
|
||||
slash.RegisterCommands<Store>(922419263275425832uL);
|
||||
// Degenz
|
||||
//slash.RegisterCommands<HackerGame>(922414052708327494uL);
|
||||
|
||||
client.ConnectAsync ()
|
||||
|> Async.AwaitTask
|
||||
|> Async.RunSynchronously
|
||||
|
||||
Task.Delay(-1)
|
||||
|> Async.AwaitTask
|
||||
|> Async.RunSynchronously
|
||||
|
||||
client.DisconnectAsync ()
|
||||
|> Async.AwaitTask
|
||||
|> Async.RunSynchronously
|
||||
|
@ -1,15 +1,13 @@
|
||||
open System
|
||||
module Degenz.Trainer
|
||||
|
||||
open System.Threading.Tasks
|
||||
open DSharpPlus
|
||||
open DSharpPlus.Entities
|
||||
open DSharpPlus.EventArgs
|
||||
open DSharpPlus.SlashCommands
|
||||
open DegenzGame
|
||||
open DegenzGame.Shared
|
||||
open Degenz.Shared
|
||||
open Emzi0767.Utilities
|
||||
|
||||
type EmptyGlobalCommandToAvoidFamousDuplicateSlashCommandsBug() = inherit ApplicationCommandModule ()
|
||||
|
||||
type Trainer() =
|
||||
inherit ApplicationCommandModule ()
|
||||
|
||||
@ -71,16 +69,6 @@ type Trainer() =
|
||||
} |> Async.StartAsTask
|
||||
:> Task
|
||||
|
||||
let config = DiscordConfiguration()
|
||||
config.Token <- "OTMzMDg4MTQyNDM5ODk5MTg4.YeccDQ.AbysjlHICgbNQVyduG6aGIHNpdE"
|
||||
config.TokenType <- TokenType.Bot
|
||||
config.Intents <- DiscordIntents.All
|
||||
//config.MinimumLogLevel <- Microsoft.Extensions.Logging.LogLevel.Trace
|
||||
|
||||
let client = new DiscordClient(config)
|
||||
|
||||
let slash = client.UseSlashCommands()
|
||||
|
||||
let sendMessage (event : ComponentInteractionCreateEventArgs) msg =
|
||||
async {
|
||||
let builder = DiscordFollowupMessageBuilder()
|
||||
@ -158,6 +146,15 @@ let handleButtonEvent (_ : DiscordClient) (event : ComponentInteractionCreateEve
|
||||
|> Async.StartAsTask
|
||||
:> Task
|
||||
|
||||
let config = DiscordConfiguration()
|
||||
config.Token <- "OTMzMDg4MTQyNDM5ODk5MTg4.YeccDQ.AbysjlHICgbNQVyduG6aGIHNpdE"
|
||||
config.TokenType <- TokenType.Bot
|
||||
config.Intents <- DiscordIntents.All
|
||||
//config.MinimumLogLevel <- Microsoft.Extensions.Logging.LogLevel.Trace
|
||||
|
||||
let client = new DiscordClient(config)
|
||||
|
||||
let slash = client.UseSlashCommands()
|
||||
|
||||
client.add_ComponentInteractionCreated(AsyncEventHandler(handleButtonEvent))
|
||||
|
@ -1,4 +1,4 @@
|
||||
module DegenzGame.Shared
|
||||
module Degenz.Shared
|
||||
|
||||
open System
|
||||
open DSharpPlus
|
||||
|
@ -5,8 +5,8 @@
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Shared.fs" />
|
||||
<Content Include="paket.references" />
|
||||
<Compile Include="Shared.fs" />
|
||||
</ItemGroup>
|
||||
<Import Project="..\.paket\Paket.Restore.targets" />
|
||||
</Project>
|
@ -5,9 +5,6 @@
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="SlotMachine.fs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include=".dockerignore" />
|
||||
<Content Include="Dockerfile" />
|
||||
|
@ -5,17 +5,10 @@
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Store.fs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include=".dockerignore" />
|
||||
<Content Include="Dockerfile" />
|
||||
<Content Include="paket.references" />
|
||||
<Content Include="..\GameConfig\Items.json">
|
||||
<Link>Items.json</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DbService\DbService.fsproj" />
|
||||
|
@ -3,11 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<OutputType>Exe</OutputType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Trainer.fs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include=".dockerignore" />
|
||||
<Content Include="Dockerfile" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user