From fc75c3f238bd850d6bb7300dc1b06e4152125dd9 Mon Sep 17 00:00:00 2001 From: Joseph Ferano Date: Wed, 19 Jan 2022 23:35:57 +0700 Subject: [PATCH] Getting dotenv working, I think --- .gitignore | 2 ++ PlayerInteractions/Bot.fs | 16 +++++++++++----- PlayerInteractions/PlayerInteractions.fsproj | 2 -- PlayerInteractions/paket.references | 5 +---- paket.dependencies | 2 ++ paket.lock | 4 +++- 6 files changed, 19 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index 253f8ad..95268f0 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,8 @@ *.userosscache *.sln.docstates +.env + # User-specific files (MonoDevelop/Xamarin Studio) *.userprefs diff --git a/PlayerInteractions/Bot.fs b/PlayerInteractions/Bot.fs index 3e07b14..2508e45 100644 --- a/PlayerInteractions/Bot.fs +++ b/PlayerInteractions/Bot.fs @@ -1,5 +1,6 @@ module Degenz.Bot +open System open System.Threading.Tasks open DSharpPlus open DSharpPlus.SlashCommands @@ -10,6 +11,7 @@ open Degenz.SlotMachine open Degenz.Trainer open Degenz.HackerBattle open Degenz.Store +open dotenv.net type EmptyGlobalCommandToAvoidFamousDuplicateSlashCommandsBug() = inherit ApplicationCommandModule () @@ -26,11 +28,15 @@ 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" + +//DotEnv.Load(DotEnvOptions(probeForEnv = true, probeLevelsToSearch = 4)) +DotEnv.Load(DotEnvOptions(probeForEnv = true, probeLevelsToSearch = 5, overwriteExistingVars = false)) + +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 diff --git a/PlayerInteractions/PlayerInteractions.fsproj b/PlayerInteractions/PlayerInteractions.fsproj index fcad2ff..1c6e14d 100644 --- a/PlayerInteractions/PlayerInteractions.fsproj +++ b/PlayerInteractions/PlayerInteractions.fsproj @@ -7,9 +7,7 @@ PlayerRegistration - - diff --git a/PlayerInteractions/paket.references b/PlayerInteractions/paket.references index a5fcca2..9caa48b 100644 --- a/PlayerInteractions/paket.references +++ b/PlayerInteractions/paket.references @@ -1,7 +1,4 @@ FSharp.Core DSharpPlus -// DSharpPlus.CommandsNext -// DSharpPlus.Interactivity DSharpPlus.SlashCommands - -// MongoDB.Driver +dotenv.net diff --git a/paket.dependencies b/paket.dependencies index 3c855a5..535425c 100644 --- a/paket.dependencies +++ b/paket.dependencies @@ -11,3 +11,5 @@ nuget DSharpPlus >= 4.2.0-nightly-01054 nuget DSharpPlus.SlashCommands >= 4.2.0-nightly-01061 nuget MongoDB.Driver + +nuget dotenv.net 3.1.1 diff --git a/paket.lock b/paket.lock index 564e343..f0c8b76 100644 --- a/paket.lock +++ b/paket.lock @@ -5,6 +5,8 @@ NUGET DnsClient (1.5) Microsoft.Win32.Registry (>= 5.0) System.Buffers (>= 4.5.1) - restriction: || (&& (== net6.0) (>= net471)) (&& (== net6.0) (< netstandard2.0)) (&& (== net6.0) (< netstandard2.1)) (== netstandard2.0) (&& (== netstandard2.1) (>= net471)) (&& (== netstandard2.1) (< netstandard2.0)) + dotenv.net (3.1.1) + System.Memory (>= 4.5.4) - restriction: || (&& (== net6.0) (< netstandard2.0)) (&& (== net6.0) (< netstandard2.1)) (== netstandard2.0) (&& (== netstandard2.1) (< netstandard2.0)) Emzi0767.Common (2.6.2) System.Collections.Immutable (>= 5.0) System.Memory (>= 4.5.4) @@ -289,7 +291,7 @@ NUGET System.Threading (>= 4.3) System.Threading.Tasks (>= 4.3) System.Threading.Timer (>= 4.3) - System.Numerics.Vectors (4.5) - restriction: || (&& (== net6.0) (< netcoreapp2.0)) (== netstandard2.0) (== netstandard2.1) + System.Numerics.Vectors (4.5) - restriction: || (&& (== net6.0) (< netcoreapp2.0) (< netstandard2.1)) (&& (== net6.0) (< netstandard2.0)) (== netstandard2.0) (&& (== netstandard2.1) (< netstandard2.0)) System.Reflection (4.3) Microsoft.NETCore.Platforms (>= 1.1) Microsoft.NETCore.Targets (>= 1.1)