]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/urban.rb
url plugin: only chop non-word characters on 404
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / urban.rb
index 9c55a06ededf18d110a8371029648cea0e423930..6f052fcf9d92d907f066ad942a0cc869993d760d 100644 (file)
@@ -17,7 +17,7 @@ class UrbanPlugin < Plugin
     u = URBAN + URI.escape(word)
     u += '&page=' + p.to_s if p > 1
     s = @bot.httputil.get(u)
-    return m.reply "Couldn't get the urban dictionary definition for #{word}" if s.nil?
+    return m.reply("Couldn't get the urban dictionary definition for #{word}") if s.nil?
 
     notfound = s.match %r{<div style="color: #669FCE"><i>.*?</i> isn't defined}
 
@@ -48,7 +48,7 @@ class UrbanPlugin < Plugin
       resp = @bot.httputil.head('http://www.urbandictionary.com/random.php',
                                :max_redir => -1,
                                :cache => false)
-      return m.reply "Couldn't get the urban dictionary word of the day" if resp.nil?
+      return m.reply("Couldn't get a random urban dictionary word") if resp.nil?
       if resp.code == "302" && (loc = resp['location'])
         words = URI.unescape(loc.match(/define.php\?term=(.*)$/)[1]) rescue nil
       end