- "bash => print a random quote from bash.org, bash quote_id => print that quote id from bash.org, bash latest => print the latest quote from bash.org (currently broken, need to get josh@bash.org to fix the xml)"
+ [
+ _("bash => print a random quote from bash.org"),
+ _("bash quote_id => print that quote id from bash.org"),
+ _("bash search <terms> => print the first bash.org quote matching <terms>"),
+ _("bash latest => print the latest quote from bash.org")
+ ].join(", ")
+ end
+
+ def bash_filter(s)
+ # check if we like the location of the page
+ loc = Utils.check_location(s, %r{http://(?:www\.)?bash\.org/\?})
+ return unless loc
+ # check if there are any quotes
+ quotes = get_html_quotes(s[:text])
+ return if quotes.empty?
+ title = s[:text].ircify_html_title
+ # return the first quote
+ return {
+ :title => title,
+ :content => quotes.first.to_s,
+ :bash_quotes => quotes
+ }
+ end
+
+ def initialize
+ super
+
+ @bot.register_filter(:bash, :htmlinfo) { |s| bash_filter(s) }