84 lines
2.7 KiB
Forth
84 lines
2.7 KiB
Forth
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<PlayerInteractions>(guild);
|
|
sc2.RegisterCommands<Trainer>(guild);
|
|
sc3.RegisterCommands<HackerGame>(guild);
|
|
sc4.RegisterCommands<Store>(guild);
|
|
sc5.RegisterCommands<SlotMachine>(guild);
|
|
// Degenz
|
|
//slash.RegisterCommands<HackerGame>(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
|
|
|
|
|