| @@ -8,12 +8,6 @@ using Discord.WebSocket; | |||||
| class Program | class Program | ||||
| { | { | ||||
| private readonly DiscordSocketClient _client; | |||||
| // Keep the CommandService and IServiceCollection around for use with commands. | |||||
| private readonly IServiceCollection _map = new ServiceCollection(); | |||||
| private readonly CommandService _commands = new CommandService(); | |||||
| // Program entry point | // Program entry point | ||||
| static void Main(string[] args) | static void Main(string[] args) | ||||
| { | { | ||||
| @@ -22,6 +16,12 @@ class Program | |||||
| new Program().MainAsync().GetAwaiter().GetResult(); | new Program().MainAsync().GetAwaiter().GetResult(); | ||||
| } | } | ||||
| private readonly DiscordSocketClient _client; | |||||
| // Keep the CommandService and IServiceCollection around for use with commands. | |||||
| private readonly IServiceCollection _map = new ServiceCollection(); | |||||
| private readonly CommandService _commands = new CommandService(); | |||||
| private Program() | private Program() | ||||
| { | { | ||||
| _client = new DiscordSocketClient(new DiscordSocketConfig | _client = new DiscordSocketClient(new DiscordSocketConfig | ||||
| @@ -48,7 +48,6 @@ class Program | |||||
| // that ask for a Func<LogMessage, Task>. | // that ask for a Func<LogMessage, Task>. | ||||
| private static Task Logger(LogMessage message) | private static Task Logger(LogMessage message) | ||||
| { | { | ||||
| var cc = Console.ForegroundColor; | |||||
| switch (message.Severity) | switch (message.Severity) | ||||
| { | { | ||||
| case LogSeverity.Critical: | case LogSeverity.Critical: | ||||
| @@ -67,7 +66,7 @@ class Program | |||||
| break; | break; | ||||
| } | } | ||||
| Console.WriteLine($"{DateTime.Now,-19} [{message.Severity,8}] {message.Source}: {message.Message}"); | Console.WriteLine($"{DateTime.Now,-19} [{message.Severity,8}] {message.Source}: {message.Message}"); | ||||
| Console.ForegroundColor = cc; | |||||
| Console.ResetColor(); | |||||
| // If you get an error saying 'CompletedTask' doesn't exist, | // If you get an error saying 'CompletedTask' doesn't exist, | ||||
| // your project is targeting .NET 4.5.2 or lower. You'll need | // your project is targeting .NET 4.5.2 or lower. You'll need | ||||