// M a i n public async void Start() { if (!string.IsNullOrEmpty(Config.DiscordBotToken)) { Client = new DiscordSocketClient(); Client.Log += Client_Log; Client.Ready += Client_Ready; Client.Disconnected += Client_Disconnected; await Client.LoginAsync(TokenType.Bot, Config.DiscordBotToken); await Client.StartAsync(); } else { LoggedMsg?.Invoke(this, "Disabled or Token invalid", true); } }
private Task Client_Log(LogMessage msg) { Task.Run(() => LoggedMsg?.Invoke(this, msg.Message, msg.Exception is object)); return(Task.CompletedTask); }