console messages improved.

This commit is contained in:
Master Kwoth 2016-01-21 23:22:55 +01:00
parent 40227a175a
commit 7cc1a50de9
5 changed files with 42 additions and 7 deletions

View File

@ -23,6 +23,7 @@ Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
FullDebug|Any CPU = FullDebug|Any CPU FullDebug|Any CPU = FullDebug|Any CPU
PRIVATE|Any CPU = PRIVATE|Any CPU
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution 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}.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.ActiveCfg = Debug|Any CPU
{27A886F5-CDDA-4F4A-81EE-6DAFCCE9DE46}.FullDebug|Any CPU.Build.0 = 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.ActiveCfg = Release|Any CPU
{27A886F5-CDDA-4F4A-81EE-6DAFCCE9DE46}.Release|Any CPU.Build.0 = 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.ActiveCfg = Debug|Any CPU
{8D71A857-879A-4A10-859E-5FF824ED6688}.Debug|Any CPU.Build.0 = 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.ActiveCfg = Debug|Any CPU
{8D71A857-879A-4A10-859E-5FF824ED6688}.FullDebug|Any CPU.Build.0 = 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.ActiveCfg = Release|Any CPU
{8D71A857-879A-4A10-859E-5FF824ED6688}.Release|Any CPU.Build.0 = 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.ActiveCfg = Debug|Any CPU
{3091164F-66AE-4543-A63D-167C1116241D}.Debug|Any CPU.Build.0 = 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.ActiveCfg = Debug|Any CPU
{3091164F-66AE-4543-A63D-167C1116241D}.FullDebug|Any CPU.Build.0 = 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.ActiveCfg = Release|Any CPU
{3091164F-66AE-4543-A63D-167C1116241D}.Release|Any CPU.Build.0 = 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.ActiveCfg = Debug|Any CPU
{1B5603B4-6F8F-4289-B945-7BAAE523D740}.Debug|Any CPU.Build.0 = 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.ActiveCfg = Debug|Any CPU
{1B5603B4-6F8F-4289-B945-7BAAE523D740}.FullDebug|Any CPU.Build.0 = 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.ActiveCfg = Release|Any CPU
{1B5603B4-6F8F-4289-B945-7BAAE523D740}.Release|Any CPU.Build.0 = 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.ActiveCfg = Debug|Any CPU
{7BFEF748-B934-4621-9B11-6302E3A9F6B3}.Debug|Any CPU.Build.0 = 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.ActiveCfg = Debug|Any CPU
{7BFEF748-B934-4621-9B11-6302E3A9F6B3}.FullDebug|Any CPU.Build.0 = 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.ActiveCfg = Release|Any CPU
{7BFEF748-B934-4621-9B11-6302E3A9F6B3}.Release|Any CPU.Build.0 = Release|Any CPU {7BFEF748-B934-4621-9B11-6302E3A9F6B3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection

View File

@ -120,9 +120,15 @@ namespace NadekoBot.Extensions
/// <typeparam name="T"></typeparam> /// <typeparam name="T"></typeparam>
/// <param name="source"></param> /// <param name="source"></param>
/// <param name="action"></param> /// <param name="action"></param>
public static string ShortenUrl(this string str) { public static string ShortenUrl(this string str) => Searches.ShortenUrl(str);
return Searches.ShortenUrl(str);
} /// <summary>
/// Gets the program runtime
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="source"></param>
/// <param name="action"></param>
public static string GetRuntime(this DiscordClient c) => ".Net Framework 4.5.2";
public static void ForEach<T>(this IEnumerable<T> source, Action<T> action) { public static void ForEach<T>(this IEnumerable<T> source, Action<T> action) {
foreach (T element in source) { foreach (T element in source) {

View File

@ -35,18 +35,20 @@ namespace NadekoBot
if (c.GoogleAPIKey == null || c.GoogleAPIKey == "") { 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."); Console.WriteLine("No google api key found. You will not be able to use music and links won't be shortened.");
} else { } else {
Console.WriteLine("Google API key provided.");
GoogleAPIKey = c.GoogleAPIKey; GoogleAPIKey = c.GoogleAPIKey;
} }
if (c.TrelloAppKey == null || c.TrelloAppKey == "") { if (c.TrelloAppKey == null || c.TrelloAppKey == "") {
Console.WriteLine("No trello appkey found. You will not be able to use trello commands."); Console.WriteLine("No trello appkey found. You will not be able to use trello commands.");
} else { } else {
Console.WriteLine("Trello app key provided.");
TrelloAppKey = c.TrelloAppKey; TrelloAppKey = c.TrelloAppKey;
trelloLoaded = true; trelloLoaded = true;
} }
OwnerID = c.OwnerID; OwnerID = c.OwnerID;
password = c.Password; password = c.Password;
} }
catch (Exception) catch (Exception ex)
{ {
Console.WriteLine("Failed to load stuff from credentials.json, RTFM"); Console.WriteLine("Failed to load stuff from credentials.json, RTFM");
Console.ReadKey(); Console.ReadKey();
@ -70,7 +72,7 @@ namespace NadekoBot
//monitor commands for logging //monitor commands for logging
stats_collector = new StatsCollector(commandService); stats_collector = new StatsCollector(commandService);
} else { } 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 //reply to personal messages
@ -102,11 +104,17 @@ namespace NadekoBot
client.ExecuteAndWait(async () => client.ExecuteAndWait(async () =>
{ {
await client.Connect(c.Username, c.Password); 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("Logged in as: " + client.CurrentUser.Name);
Console.WriteLine("Bot id: " + client.CurrentUser.Id); Console.WriteLine("Bot id: " + client.CurrentUser.Id);
Console.WriteLine("Servers: " + client.Servers.Count()); Console.WriteLine("Servers: " + client.Servers.Count());
Console.WriteLine("Channels: " + client.Servers.Sum(s=>s.AllChannels.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("-------------------------");
}); });
Console.WriteLine("Exiting..."); Console.WriteLine("Exiting...");

View File

@ -62,6 +62,16 @@
<PropertyGroup> <PropertyGroup>
<SignManifests>true</SignManifests> <SignManifests>true</SignManifests>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'PRIVATE|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\PRIVATE\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Manatee.Json, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c267f67a39449c62, processorArchitecture=MSIL"> <Reference Include="Manatee.Json, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c267f67a39449c62, processorArchitecture=MSIL">
<HintPath>..\packages\Manatee.Json.3.2.1\lib\net45\Manatee.Json.dll</HintPath> <HintPath>..\packages\Manatee.Json.3.2.1\lib\net45\Manatee.Json.dll</HintPath>

View File

@ -30,6 +30,7 @@ namespace NadekoBot
//NadekoBot.client.MessageReceived += Client_MessageReceived; //NadekoBot.client.MessageReceived += Client_MessageReceived;
StartCollecting(); StartCollecting();
Console.WriteLine("Logging enabled.");
} }
private void FillConsole() { private void FillConsole() {
@ -101,7 +102,6 @@ namespace NadekoBot
obj.SaveAsync(); obj.SaveAsync();
}; };
Console.WriteLine("Server stats sent.");
} }
public static void SaveRequest(CommandEventArgs e, string text) { public static void SaveRequest(CommandEventArgs e, string text) {