// ---- Handlers ---- /// <summary> /// Handles the help command. /// </summary> /// <param name="writer">The IRC Writer to write to.</param> /// <param name="response">The response from the channel.</param> private static void HandleHelpCommand(IIrcWriter writer, MessageHandlerArgs response) { writer.SendMessage( "Valid commands: XXXXX (US Zip Code), help, about, sourcecode. Each command has a " + cooldown + " second cooldown.", response.Channel ); }
private async void CheckForUpdates(FeedReader reader, IIrcWriter writer, IList <string> channels) { try { this.pluginLogger.WriteLine( Convert.ToInt32(LogVerbosityLevel.LowVerbosity), "Fetching RSS feed for '" + reader.Url + "'" ); IList <SyndicationItem> newItems = await reader.UpdateAsync(); if (newItems.Count > 0) { this.pluginLogger.WriteLine( Convert.ToInt32(LogVerbosityLevel.LowVerbosity), "Found updates on RSS feed '" + reader.Url + "', sending to channels..." ); foreach (SyndicationItem item in newItems) { string msg = string.Empty; if (item.Links.Count > 0) { msg = string.Format( "{0}: '{1}' {2}", reader.FeedTitle, item.Title.Text, item.Links[0].Uri.ToString() ); } else { msg = string.Format( "{0}: '{1}'", reader.FeedTitle, item.Title.Text ); } foreach (string channel in channels) { writer.SendMessage( msg, channel ); } } } else { this.pluginLogger.WriteLine( Convert.ToInt32(LogVerbosityLevel.HighVerbosity), "No updates for RSS feed '" + reader.Url + "'" ); } } catch (Exception err) { this.pluginLogger.ErrorWriteLine( "An Exception was caught while updating feed {0}:{1}{2}", reader.FeedTitle, Environment.NewLine, err.ToString() ); } }