/// <summary> /// On creation, startup the IRC client to hook onto the twitch chat /// </summary> public override void OnCreated(IChirper c) { //c.DestroyBuiltinChirper(); Configuration.ReloadConfigFile(); if (IrcClient == null) IrcClient = new IrcClient(Logger); // The noise will drive people bonkers ChirpPanel cp = ChirpPanel.instance; if (cp != null) cp.m_NotificationSound = null; CustomCitizens = GetCustomCitizens(); //bool enterPressed = Event.current.type == EventType.KeyDown && (Event.current.keyCode == KeyCode.Return || Event.current.keyCode == KeyCode.KeypadEnter); // If they're using the default username, make them aware of the options tab GetChirperManager.AddMessage("chirpertestclient", "Welcome to Twitch Chirper Chat! Click the Options button or press Alt+C to access options!", MessagePriority.Critical); DebugOutputPanel.AddMessage(PluginManager.MessageType.Message, String.Format("User Name: {0} - Channel: {1} - Connecting to Irc...", Configuration.ConfigurationSettings.UserName, Configuration.ConfigurationSettings.IrcChannel)); try { if (_apiManager != null) _apiManager.Dispose(); } // ReSharper disable once EmptyGeneralCatchClause catch {} _apiManager = new ApiManager(Logger, Configuration.ConfigurationSettings.IrcChannel); _apiManager.NewFollowers += _apiManager_NewFollowers; _apiManager.StartWatching(); // Hook up the Irc client events and execute a connection IrcClient.ChatMessageReceived += _ircClient_ChatMessageReceived; IrcClient.Disconnected += _ircClient_Disconnected; IrcClient.Connected += _ircClient_Connected; IrcClient.NewSubscriber += _ircClient_NewSubscriber; IrcClient.Connect(Configuration.ConfigurationSettings.UserName, Configuration.ConfigurationSettings.OAuthKey, Configuration.ConfigurationSettings.IrcChannel); }