internal void Run() { while (true) { try { while (true) { TwitchChatEvent chatEvent = GetNextChatEvent(); RespondToEvent(chatEvent); } } catch (IOException connectionException) { Log.error("Irc connection issue: ", connectionException); } Thread.SleepInSeconds(30); Reconnect(); } }
private TwitchChatEvent GetNextChatEvent() { string chatEventCommand = ircClient.ReadNextLine_BLOCKING(); if (chatEventCommand == null) { if (Reconnect()) { return(GetNextChatEvent()); } else { throw new Exception(); } } else { return(TwitchChatEvent.Parse(factory, chatEventCommand)); } }
internal void RespondToEvent(TwitchChatEvent chatEvent) { Log.info(chatEvent.ToString()); chatEvent.RespondToEvent(chatRooms); }