]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/bash.rb
chucknorris: read gzip stream before passing it to YAML.load
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / bash.rb
index 2d52a5ecd09b4d3bb8abb87b44fb3a89d7014c08..8dac9671792b7b1c2e0375a751674464aac799ab 100644 (file)
@@ -67,7 +67,12 @@ class BashPlugin < Plugin
 
   include REXML
   def help(plugin, topic="")
-    "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)
@@ -156,7 +161,7 @@ class BashPlugin < Plugin
       # may want to echo more than one for latest/random
       quote = quotes.first
     end
-    m.reply quote.to_s
+    m.reply quote.to_s, :split_at => /\s+\|\s+/
   end
 
   def xml_bash(m, id=nil)
@@ -167,7 +172,7 @@ class BashPlugin < Plugin
       xml = @bot.httputil.get("http://bash.org/xml/?random&num=1", :cache => false)
     else
       xml = @bot.httputil.get("http://bash.org/xml/?" + id + "&num=1")
-    end        
+    end
 
     unless xml
       m.reply "bash.org rss parse failed"
@@ -179,7 +184,7 @@ class BashPlugin < Plugin
       return
     end
     doc.elements.each("*/item") {|e|
-      if(id != 0) 
+      if(id != 0)
         reply = e.elements["title"].text.gsub(/QDB: /,"") + " " + e.elements["link"].text.gsub(/QDB: /,"") + "\n"
         reply = reply + e.elements["description"].text.gsub(/\<br \/\>/, "\n")
       else