From 203811366bf63a6b19a477beacffe611a0b7146d Mon Sep 17 00:00:00 2001 From: Karolis2011 Date: Thu, 5 Sep 2019 21:23:41 +0300 Subject: [PATCH] Updates things and adds debug options --- EventBot/EventBot.csproj | 12 ++++++------ EventBot/Program.cs | 21 +++++++++++++++------ 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/EventBot/EventBot.csproj b/EventBot/EventBot.csproj index 67da6ae..a7df182 100644 --- a/EventBot/EventBot.csproj +++ b/EventBot/EventBot.csproj @@ -9,15 +9,15 @@ - - - - - + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/EventBot/Program.cs b/EventBot/Program.cs index f882ebf..d92329a 100644 --- a/EventBot/Program.cs +++ b/EventBot/Program.cs @@ -49,12 +49,7 @@ namespace EventBot private ServiceProvider ConfigureServices() { return new ServiceCollection() - .AddSingleton(s => new DiscordSocketClient(new DiscordSocketConfig() { -#if DEBUG - LogLevel = LogSeverity.Debug, -#endif - MessageCacheSize = 1500 - })) + .AddSingleton(s => new DiscordSocketClient(getDiscordSocketConfig())) .AddSingleton() .AddSingleton() .AddSingleton() @@ -69,5 +64,19 @@ namespace EventBot //.AddSingleton() .BuildServiceProvider(); } + + private DiscordSocketConfig getDiscordSocketConfig() + { + var config = new DiscordSocketConfig() + { + MessageCacheSize = 1500 + }; +#if DEBUG + config.LogLevel = LogSeverity.Debug; +#endif + if(Environment.GetEnvironmentVariable("DEBUG") != null) + config.LogLevel = LogSeverity.Debug; + return config; + } } }