X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Fbash.rb;h=8dac9671792b7b1c2e0375a751674464aac799ab;hb=b955d424d89655a04ba5f06d3cfee482ae33e713;hp=a09c53abdd13e5a893971618d0fe450431b2a374;hpb=84b3bce9fb4d7d3b64ce20964bb43564b1881ce0;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/bash.rb b/data/rbot/plugins/bash.rb index a09c53ab..8dac9671 100644 --- a/data/rbot/plugins/bash.rb +++ b/data/rbot/plugins/bash.rb @@ -70,7 +70,8 @@ class BashPlugin < Plugin [ _("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 search => print the first bash.org quote matching "), + _("bash latest => print the latest quote from bash.org") ].join(", ") end @@ -160,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) @@ -171,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" @@ -183,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(/\
/, "\n") else