77 lines
2.4 KiB
Forth
77 lines
2.4 KiB
Forth
module Degenz.Bot
|
|
|
|
open System
|
|
open System.Threading.Tasks
|
|
open DSharpPlus
|
|
open DSharpPlus.SlashCommands
|
|
open Degenz
|
|
open Degenz.PlayerInteractions
|
|
//open Degenz.SlotMachine
|
|
open Degenz.HackerBattle
|
|
open Degenz.Store
|
|
open Emzi0767.Utilities
|
|
|
|
type EmptyGlobalCommandToAvoidFamousDuplicateSlashCommandsBug() = inherit ApplicationCommandModule ()
|
|
|
|
let playerInteractionsConfig = DiscordConfiguration()
|
|
let hackerBattleConfig = DiscordConfiguration()
|
|
let storeConfig = DiscordConfiguration()
|
|
//let slotMachineConfig = DiscordConfiguration()
|
|
//hackerBattleConfig.MinimumLogLevel <- Microsoft.Extensions.Logging.LogLevel.Trace
|
|
|
|
//let configs = [| playerInteractionsConfig ; hackerBattleConfig ; storeConfig ; slotMachineConfig ; |]
|
|
let configs = [| playerInteractionsConfig ; hackerBattleConfig ; storeConfig |]
|
|
|
|
for conf in configs do
|
|
conf.TokenType <- TokenType.Bot
|
|
conf.Intents <- DiscordIntents.All
|
|
|
|
|
|
let guild = GuildEnvironment.guildId
|
|
|
|
playerInteractionsConfig.Token <- GuildEnvironment.tokenPlayerInteractions
|
|
hackerBattleConfig.Token <- GuildEnvironment.tokenHackerBattle
|
|
storeConfig.Token <- GuildEnvironment.tokenStore
|
|
//slotMachineConfig.Token <- Environment.GetEnvironmentVariable("BOT_SLOT_MACHINE")
|
|
|
|
let playerInteractionsBot = new DiscordClient(playerInteractionsConfig)
|
|
let hackerBattleBot = new DiscordClient(hackerBattleConfig)
|
|
let storeBot = new DiscordClient(storeConfig)
|
|
//let slotMachineBot = new DiscordClient(slotMachineConfig)
|
|
|
|
//let clients = [| storeBot ; trainerBot ; hackerBattleBot ; playerInteractionsBot ; slotMachineBot |]
|
|
let clients = [| storeBot ; hackerBattleBot ; playerInteractionsBot |]
|
|
|
|
let sc1 = playerInteractionsBot.UseSlashCommands()
|
|
let sc3 = hackerBattleBot.UseSlashCommands()
|
|
let sc4 = storeBot.UseSlashCommands()
|
|
//let sc5 = slotMachineBot.UseSlashCommands()
|
|
|
|
sc1.RegisterCommands<PlayerInteractions>(guild);
|
|
sc3.RegisterCommands<HackerGame>(guild);
|
|
sc4.RegisterCommands<Store>(guild);
|
|
//sc5.RegisterCommands<SlotMachine>(guild);
|
|
|
|
hackerBattleBot.add_ComponentInteractionCreated(AsyncEventHandler(HackerBattle.handleButtonEvent))
|
|
storeBot.add_ComponentInteractionCreated(AsyncEventHandler(Store.handleSellButtonEvents))
|
|
|
|
let run (client : DiscordClient) =
|
|
async {
|
|
do! client.ConnectAsync () |> Async.AwaitTask
|
|
}
|
|
|
|
Trainer.sendInitialEmbed hackerBattleBot
|
|
|
|
clients
|
|
|> Array.map run
|
|
|> Array.toSeq
|
|
|> Async.Sequential
|
|
|> Async.RunSynchronously
|
|
|> ignore
|
|
|
|
Task.Delay(-1)
|
|
|> Async.AwaitTask
|
|
|> Async.RunSynchronously
|
|
|
|
|