module Degenz.Bot open System 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 open dotenv.net 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 //DotEnv.Load(DotEnvOptions(probeForEnv = true, probeLevelsToSearch = 4)) DotEnv.Load(DotEnvOptions(probeForEnv = true, probeLevelsToSearch = 5, overwriteExistingVars = false)) let guild = Environment.GetEnvironmentVariable("DISCORD_GUILD") |> uint64 playerInteractionsConfig.Token <- Environment.GetEnvironmentVariable("BOT_PLAYER_INTERACTIONS") trainerConfig.Token <- Environment.GetEnvironmentVariable("BOT_TRAINER") hackerBattleConfig.Token <- Environment.GetEnvironmentVariable("BOT_HACKER_BATTLE") storeConfig.Token <- Environment.GetEnvironmentVariable("BOT_STORE") slotMachineConfig.Token <- Environment.GetEnvironmentVariable("BOT_SLOT_MACHINE") //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 sc1 = playerInteractionsBot.UseSlashCommands() let sc2 = trainerBot.UseSlashCommands() let sc3 = hackerBattleBot.UseSlashCommands() let sc4 = storeBot.UseSlashCommands() let sc5 = slotMachineBot.UseSlashCommands() sc1.RegisterCommands(guild); sc2.RegisterCommands(guild); sc3.RegisterCommands(guild); sc4.RegisterCommands(guild); sc5.RegisterCommands(guild); // Degenz //slash.RegisterCommands(922414052708327494uL); let run (client : DiscordClient) = async { do! client.ConnectAsync () |> Async.AwaitTask } clients |> Array.map run |> Array.toSeq |> Async.Sequential |> Async.RunSynchronously |> ignore Task.Delay(-1) |> Async.AwaitTask |> Async.RunSynchronously