protected override void DoConnect() { socket = new DiscordWebsocket(); socket.Token = Config.BotToken; socket.Status = Config.Status; socket.GetStatus = GetStatusMessage; socket.OnReady = HandleReadyEvent; socket.OnMessageCreate = HandleMessageEvent; socket.OnChannelCreate = HandleChannelEvent; socket.Connect(); }
protected override void DoConnect() { socket = new DiscordWebsocket(); socket.Session = session; socket.Token = Config.BotToken; socket.Presence = Config.PresenceEnabled; socket.Status = Config.Status; socket.Activity = Config.Activity; socket.GetStatus = GetStatusMessage; socket.OnReady = HandleReadyEvent; socket.OnResumed = HandleResumedEvent; socket.OnMessageCreate = HandleMessageEvent; socket.OnChannelCreate = HandleChannelEvent; socket.Connect(); }
void IOThread() { try { socket.Connect(); socket.ReadLoop(); } catch (Exception ex) { Logger.LogError("Discord relay error", ex); if (disconnecting) { return; } // try to recover from dropped connection TryReconnect(); } }