From 1bfcb4d32a60e5baa7b4f8ab08223ea4dbb82d78 Mon Sep 17 00:00:00 2001 From: Joseph Ferano Date: Mon, 31 Jan 2022 22:00:59 +0700 Subject: [PATCH] Re-add actions --- Bot/Bot.fs | 5 ++--- Bot/GuildEnvironment.fs | 4 ++-- Bot/PlayerInteractions.fs | 4 ++-- DbService/DbService.fs | 6 ++++-- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Bot/Bot.fs b/Bot/Bot.fs index ff20b88..d328966 100644 --- a/Bot/Bot.fs +++ b/Bot/Bot.fs @@ -25,10 +25,9 @@ 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 +playerInteractionsConfig.Token <- GuildEnvironment.tokenPlayerInteractions hackerBattleConfig.Token <- GuildEnvironment.tokenHackerBattle storeConfig.Token <- GuildEnvironment.tokenStore //slotMachineConfig.Token <- Environment.GetEnvironmentVariable("BOT_SLOT_MACHINE") @@ -76,7 +75,7 @@ let run (client : DiscordClient) = do! client.ConnectAsync () |> Async.AwaitTask } -Trainer.sendInitialEmbed hackerBattleBot +//Trainer.sendInitialEmbed hackerBattleBot clients |> Array.map run diff --git a/Bot/GuildEnvironment.fs b/Bot/GuildEnvironment.fs index 1b3d4b4..08bab28 100644 --- a/Bot/GuildEnvironment.fs +++ b/Bot/GuildEnvironment.fs @@ -4,8 +4,8 @@ module Degenz.GuildEnvironment open System open dotenv.net -//DotEnv.Load(DotEnvOptions(envFilePaths = [ "../../../../stag.env" ], overwriteExistingVars = false)) -DotEnv.Load(DotEnvOptions(envFilePaths = [ "../../../../prod.env" ], overwriteExistingVars = false)) +DotEnv.Load(DotEnvOptions(envFilePaths = [ "../../../../stag.env" ], overwriteExistingVars = false)) +//DotEnv.Load(DotEnvOptions(envFilePaths = [ "../../../../prod.env" ], overwriteExistingVars = false)) let getVar str = Environment.GetEnvironmentVariable(str) let getId str = getVar str |> uint64 diff --git a/Bot/PlayerInteractions.fs b/Bot/PlayerInteractions.fs index 1ea49d9..5f5008f 100644 --- a/Bot/PlayerInteractions.fs +++ b/Bot/PlayerInteractions.fs @@ -92,8 +92,8 @@ module Commands = type PlayerInteractions() = inherit ApplicationCommandModule () -// [] -// member _.AddHackerRole (ctx : InteractionContext) = Commands.addHackerRole ctx + [] + member _.AddHackerRole (ctx : InteractionContext) = Commands.addHackerRole ctx [] member this.Status (ctx : InteractionContext) = Commands.status ctx diff --git a/DbService/DbService.fs b/DbService/DbService.fs index 6dfb54a..1a57261 100644 --- a/DbService/DbService.fs +++ b/DbService/DbService.fs @@ -52,8 +52,10 @@ let private playerMap (player : PlayerData) = { DiscordId = player.DiscordId Name = player.Name Arsenal = player.Arsenal |> Array.map (fun w -> w.Id) - Attacks = [||] - Defenses = [||] + Attacks = player.Actions + |> Array.choose (fun a -> match a.Type with Attack ar -> Some (actionToAttack a ar) | _ -> None) + Defenses = player.Actions + |> Array.choose (fun a -> match a.Type with Defense -> Some (actionToDefense a) | _ -> None) Bank = int player.Bank }