public async Task Start() { PrettyConsole.NewLine("=== Dogey ==="); PrettyConsole.NewLine(); Configuration.EnsureExists(); _client = new DiscordSocketClient(new DiscordSocketConfig() { LogLevel = LogSeverity.Info, AlwaysDownloadUsers = true, MessageCacheSize = 1000 }); _client.Log += (l) => Task.Run(() => PrettyConsole.Log(l.Severity, l.Source, l.Exception?.ToString() ?? l.Message)); await _client.LoginAsync(TokenType.Bot, Configuration.Load().Token.Discord); await _client.StartAsync(); _manager = new ServiceManager(_client); await _manager.InitializeAsync(); await Task.Delay(-1); }
public static void Log(LogSeverity severity, string source, string message) { PrettyConsole.NewLine($"{DateTime.Now.ToString("hh:mm:ss")} ", ConsoleColor.DarkGray); PrettyConsole.Append($"[{severity}] ", ConsoleColor.Red); PrettyConsole.Append($"{source}: ", ConsoleColor.DarkGreen); PrettyConsole.Append(message, ConsoleColor.White); }
public static void Log(CommandContext c) { var channel = (c.Channel as SocketGuildChannel); PrettyConsole.NewLine($"{DateTime.Now.ToString("hh:mm:ss")} ", ConsoleColor.Gray); if (channel == null) { PrettyConsole.Append($"[PM] ", ConsoleColor.Magenta); } else { PrettyConsole.Append($"[{c.Guild.Name} #{channel.Name}] ", ConsoleColor.DarkGreen); } PrettyConsole.Append($"{c.User}: ", ConsoleColor.Green); PrettyConsole.Append(c.Message.Content, ConsoleColor.White); }
public static void Log(IUserMessage msg) { var channel = (msg.Channel as IGuildChannel); PrettyConsole.NewLine($"{DateTime.Now.ToString("hh:mm:ss")} ", ConsoleColor.Gray); if (channel?.Guild == null) { PrettyConsole.Append($"[PM] ", ConsoleColor.Magenta); } else { PrettyConsole.Append($"[{channel.Guild.Name} #{channel.Name}] ", ConsoleColor.DarkGreen); } PrettyConsole.Append($"{msg.Author}: ", ConsoleColor.Green); PrettyConsole.Append(msg.Content, ConsoleColor.White); }