/// <summary> /// Channel join queue thread loop. /// </summary> protected void __RunChannelJoinQueue() { try { while (KeepThreadsAlive) { try { if (Status == ClientStatus.Started && channelJoinQueue.Count > 0) { lock (channelJoinQueue) { string nextToJoin = channelJoinQueue.Dequeue(); if (nextToJoin != null) { if (!channelList.Contains(nextToJoin)) { TmiLog.Error($"Skipping channel join, no longer on list: {nextToJoin}"); } else { TmiLog.Error($"Joining channel: #{nextToJoin}"); client.Channels.Join($"#{nextToJoin}"); } } } } } catch (Exception ex) { TmiLog.Error($"Exception in channel join queue: {ex}"); } finally { Thread.Sleep(100); } } } catch (ThreadAbortException) { } catch (ThreadInterruptedException) { } TmiLog.Log("Channel join queue thread exited."); }
/// <summary> /// IRC event: connection was closed, by any means. /// May also indicate failed authentication or general timeout. /// </summary> private void Client_Disconnected(object sender, EventArgs e) { TmiLog.Error("Disconnected from Twitch IRC."); Stop(); }
/// <summary> /// IRC event: the server sent us an error message. /// </summary> private void Client_ErrorMessageReceived(object sender, IrcErrorMessageEventArgs e) { TmiLog.Error("Error message received: " + e.Message); }
/// <summary> /// IRC event: the IRC client library has encountered an error. /// </summary> private void Client_Error(object sender, IrcErrorEventArgs e) { TmiLog.Error("Error in client: " + e.Error.Message); }
/// <summary> /// IRC event: a protocol error message was received by us, e.g. because we sent an invalid command. /// </summary> private void Client_ProtocolError(object sender, IrcProtocolErrorEventArgs e) { TmiLog.Error($"Error in IRC protocol: {e.Message}"); }
/// <summary> /// IRC event: failed to establish a connection to the server (pre auth). /// </summary> private void Client_ConnectFailed(object sender, IrcErrorEventArgs e) { TmiLog.Error($"Connection to Twitch IRC failed: {e.Error}"); Stop(); }