/// <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();
        }
Example #2
0
        /// <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();
        }