private static void IrcHandlerThread() { try { while (true) { // Query for any messages from IRC messages queue var ircResponse = _ircClient.ReadLine(); // Check if we got a response back if (ircResponse != null) { // Check if the message is from the bot (i.e. a trigger response) if (ircResponse.ResponseType == IRCResponseMessageType.ServiceMessage) { // Just send the message straight to telegram _telegramClient.SendMessage(ircResponse.Message); } else if (ircResponse.ResponseType == IRCResponseMessageType.UserAction) { // Just send the message straight to telegram _telegramClient.SendMessage(ircResponse.Message); } else if (ircResponse.ResponseType == IRCResponseMessageType.UserMessage) { // Parse the message if (ircResponse.Message.StartsWith("!")) { HandleTrigger(ircResponse.Message); } _telegramClient.SendMessage($"{ircResponse.Username}: {ircResponse.Message}"); } } Thread.Sleep(250); } } catch (Exception ex) { Console.WriteLine(ex.Message); Console.Write(ex.StackTrace); } }