/// <summary> /// Launches the IRC Bot. /// This will freeze the current thread until the bot is shut down. /// </summary> public void Init() { try { PrepareConfig(); LoadMeta(false); InitGitHub(); Forum = new ForumFeed(this); Bitly.Init(Configuration.ReadString("dircbot.bitly.main", ""), Configuration.ReadString("dircbot.bitly.backup", "")); WolframAlpha.Init(Configuration.ReadString("dircbot.wolfram.appid", "")); if (string.IsNullOrEmpty(ServerAddress)) { Logger.Output(LogType.ERROR, "No address given, quitting."); return; } while (true) { try { ConnectAndRun(); throw new Exception("Somehow escaped while loop?"); } catch (Exception ex) { if (ex is ThreadAbortException) { throw ex; } Logger.Output(LogType.ERROR, "Error in primary run: " + ex.ToString()); Thread.Sleep(5000); } } } catch (Exception ex) { Logger.Output(LogType.ERROR, "Full exception: " + ex.ToString()); } finally { Logger.Output(LogType.ERROR, "RIP IN PEACE, BOT NOW DEAD!"); } }