diff --git a/NadekoBot.sln b/NadekoBot.sln index af29b679..544897ab 100644 --- a/NadekoBot.sln +++ b/NadekoBot.sln @@ -23,6 +23,7 @@ Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU FullDebug|Any CPU = FullDebug|Any CPU + PRIVATE|Any CPU = PRIVATE|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution @@ -30,30 +31,40 @@ Global {27A886F5-CDDA-4F4A-81EE-6DAFCCE9DE46}.Debug|Any CPU.Build.0 = Debug|Any CPU {27A886F5-CDDA-4F4A-81EE-6DAFCCE9DE46}.FullDebug|Any CPU.ActiveCfg = Debug|Any CPU {27A886F5-CDDA-4F4A-81EE-6DAFCCE9DE46}.FullDebug|Any CPU.Build.0 = Debug|Any CPU + {27A886F5-CDDA-4F4A-81EE-6DAFCCE9DE46}.PRIVATE|Any CPU.ActiveCfg = PRIVATE|Any CPU + {27A886F5-CDDA-4F4A-81EE-6DAFCCE9DE46}.PRIVATE|Any CPU.Build.0 = PRIVATE|Any CPU {27A886F5-CDDA-4F4A-81EE-6DAFCCE9DE46}.Release|Any CPU.ActiveCfg = Release|Any CPU {27A886F5-CDDA-4F4A-81EE-6DAFCCE9DE46}.Release|Any CPU.Build.0 = Release|Any CPU {8D71A857-879A-4A10-859E-5FF824ED6688}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8D71A857-879A-4A10-859E-5FF824ED6688}.Debug|Any CPU.Build.0 = Debug|Any CPU {8D71A857-879A-4A10-859E-5FF824ED6688}.FullDebug|Any CPU.ActiveCfg = Debug|Any CPU {8D71A857-879A-4A10-859E-5FF824ED6688}.FullDebug|Any CPU.Build.0 = Debug|Any CPU + {8D71A857-879A-4A10-859E-5FF824ED6688}.PRIVATE|Any CPU.ActiveCfg = PRIVATE|Any CPU + {8D71A857-879A-4A10-859E-5FF824ED6688}.PRIVATE|Any CPU.Build.0 = PRIVATE|Any CPU {8D71A857-879A-4A10-859E-5FF824ED6688}.Release|Any CPU.ActiveCfg = Release|Any CPU {8D71A857-879A-4A10-859E-5FF824ED6688}.Release|Any CPU.Build.0 = Release|Any CPU {3091164F-66AE-4543-A63D-167C1116241D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3091164F-66AE-4543-A63D-167C1116241D}.Debug|Any CPU.Build.0 = Debug|Any CPU {3091164F-66AE-4543-A63D-167C1116241D}.FullDebug|Any CPU.ActiveCfg = Debug|Any CPU {3091164F-66AE-4543-A63D-167C1116241D}.FullDebug|Any CPU.Build.0 = Debug|Any CPU + {3091164F-66AE-4543-A63D-167C1116241D}.PRIVATE|Any CPU.ActiveCfg = PRIVATE|Any CPU + {3091164F-66AE-4543-A63D-167C1116241D}.PRIVATE|Any CPU.Build.0 = PRIVATE|Any CPU {3091164F-66AE-4543-A63D-167C1116241D}.Release|Any CPU.ActiveCfg = Release|Any CPU {3091164F-66AE-4543-A63D-167C1116241D}.Release|Any CPU.Build.0 = Release|Any CPU {1B5603B4-6F8F-4289-B945-7BAAE523D740}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1B5603B4-6F8F-4289-B945-7BAAE523D740}.Debug|Any CPU.Build.0 = Debug|Any CPU {1B5603B4-6F8F-4289-B945-7BAAE523D740}.FullDebug|Any CPU.ActiveCfg = Debug|Any CPU {1B5603B4-6F8F-4289-B945-7BAAE523D740}.FullDebug|Any CPU.Build.0 = Debug|Any CPU + {1B5603B4-6F8F-4289-B945-7BAAE523D740}.PRIVATE|Any CPU.ActiveCfg = PRIVATE|Any CPU + {1B5603B4-6F8F-4289-B945-7BAAE523D740}.PRIVATE|Any CPU.Build.0 = PRIVATE|Any CPU {1B5603B4-6F8F-4289-B945-7BAAE523D740}.Release|Any CPU.ActiveCfg = Release|Any CPU {1B5603B4-6F8F-4289-B945-7BAAE523D740}.Release|Any CPU.Build.0 = Release|Any CPU {7BFEF748-B934-4621-9B11-6302E3A9F6B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7BFEF748-B934-4621-9B11-6302E3A9F6B3}.Debug|Any CPU.Build.0 = Debug|Any CPU {7BFEF748-B934-4621-9B11-6302E3A9F6B3}.FullDebug|Any CPU.ActiveCfg = Debug|Any CPU {7BFEF748-B934-4621-9B11-6302E3A9F6B3}.FullDebug|Any CPU.Build.0 = Debug|Any CPU + {7BFEF748-B934-4621-9B11-6302E3A9F6B3}.PRIVATE|Any CPU.ActiveCfg = PRIVATE|Any CPU + {7BFEF748-B934-4621-9B11-6302E3A9F6B3}.PRIVATE|Any CPU.Build.0 = PRIVATE|Any CPU {7BFEF748-B934-4621-9B11-6302E3A9F6B3}.Release|Any CPU.ActiveCfg = Release|Any CPU {7BFEF748-B934-4621-9B11-6302E3A9F6B3}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection diff --git a/NadekoBot/Classes/Extensions.cs b/NadekoBot/Classes/Extensions.cs index 9791d60c..a906d172 100644 --- a/NadekoBot/Classes/Extensions.cs +++ b/NadekoBot/Classes/Extensions.cs @@ -120,9 +120,15 @@ namespace NadekoBot.Extensions /// /// /// - public static string ShortenUrl(this string str) { - return Searches.ShortenUrl(str); - } + public static string ShortenUrl(this string str) => Searches.ShortenUrl(str); + + /// + /// Gets the program runtime + /// + /// + /// + /// + public static string GetRuntime(this DiscordClient c) => ".Net Framework 4.5.2"; public static void ForEach(this IEnumerable source, Action action) { foreach (T element in source) { diff --git a/NadekoBot/NadekoBot.cs b/NadekoBot/NadekoBot.cs index e44db95e..ab57d866 100644 --- a/NadekoBot/NadekoBot.cs +++ b/NadekoBot/NadekoBot.cs @@ -35,18 +35,20 @@ namespace NadekoBot if (c.GoogleAPIKey == null || c.GoogleAPIKey == "") { Console.WriteLine("No google api key found. You will not be able to use music and links won't be shortened."); } else { + Console.WriteLine("Google API key provided."); GoogleAPIKey = c.GoogleAPIKey; } if (c.TrelloAppKey == null || c.TrelloAppKey == "") { Console.WriteLine("No trello appkey found. You will not be able to use trello commands."); } else { + Console.WriteLine("Trello app key provided."); TrelloAppKey = c.TrelloAppKey; trelloLoaded = true; } OwnerID = c.OwnerID; password = c.Password; } - catch (Exception) + catch (Exception ex) { Console.WriteLine("Failed to load stuff from credentials.json, RTFM"); Console.ReadKey(); @@ -70,7 +72,7 @@ namespace NadekoBot //monitor commands for logging stats_collector = new StatsCollector(commandService); } else { - Console.WriteLine("Parse key and/or ID not found. Bot will not log."); + Console.WriteLine("Parse key and/or ID not found. Logging disabled."); } //reply to personal messages @@ -102,11 +104,17 @@ namespace NadekoBot client.ExecuteAndWait(async () => { await client.Connect(c.Username, c.Password); + Console.WriteLine("-------------------------"); + Console.WriteLine("Discord.Net version: " + DiscordConfig.LibVersion); + Console.WriteLine("Runtime: " + client.GetRuntime()); Console.WriteLine("Logged in as: " + client.CurrentUser.Name); Console.WriteLine("Bot id: " + client.CurrentUser.Id); + Console.WriteLine("Servers: " + client.Servers.Count()); Console.WriteLine("Channels: " + client.Servers.Sum(s=>s.AllChannels.Count())); - Console.WriteLine("Discord.Net version: " + DiscordConfig.LibVersion); + Console.WriteLine("Users: " + client.Servers.Sum(s => s.Users.Count())); + + Console.WriteLine("Heap: "+ Math.Round(GC.GetTotalMemory(true) / (1024.0 * 1024.0), 2).ToString() + "MB"); Console.WriteLine("-------------------------"); }); Console.WriteLine("Exiting..."); diff --git a/NadekoBot/NadekoBot.csproj b/NadekoBot/NadekoBot.csproj index ec727936..3720595c 100644 --- a/NadekoBot/NadekoBot.csproj +++ b/NadekoBot/NadekoBot.csproj @@ -62,6 +62,16 @@ true + + true + bin\PRIVATE\ + DEBUG;TRACE + full + AnyCPU + prompt + MinimumRecommendedRules.ruleset + true + ..\packages\Manatee.Json.3.2.1\lib\net45\Manatee.Json.dll diff --git a/NadekoBot/StatsCollector.cs b/NadekoBot/StatsCollector.cs index 6722ce91..ad682e08 100644 --- a/NadekoBot/StatsCollector.cs +++ b/NadekoBot/StatsCollector.cs @@ -30,6 +30,7 @@ namespace NadekoBot //NadekoBot.client.MessageReceived += Client_MessageReceived; StartCollecting(); + Console.WriteLine("Logging enabled."); } private void FillConsole() { @@ -101,7 +102,6 @@ namespace NadekoBot obj.SaveAsync(); }; - Console.WriteLine("Server stats sent."); } public static void SaveRequest(CommandEventArgs e, string text) {