/// <summary> /// Attempts to reconnect after receiving an error. /// </summary> private void Socket_OnError(object sender, WebSocketSharp.ErrorEventArgs e) { Disconnect(); var restartClient = new ChatClient(parent, BOT_TOKEN, Channel_IDs.ToArray()); PrettyPrint.Log("Discord", "Client disconnected. Attempting to reconnect..."); restartClient.Connect(); parent.Add(restartClient); Dispose(); }
/// <summary> /// Attempts to reconnect after receiving an error. /// </summary> private void Socket_OnError(object sender, WebSocketSharp.ErrorEventArgs e) { PrettyPrint.Log("Discord", e.Message, ConsoleColor.Red); Disconnect(); var restartClient = new ChatClient(parent, BOT_TOKEN, Channel_IDs.ToArray()); PrettyPrint.Log("Discord", "Restarting client...", ConsoleColor.Yellow); restartClient.Connect(); parent.Add(restartClient); Dispose(); }