]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/urban.rb
dice plugin: apply OddBloke's display patch from #143, with minor space tweaks
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / urban.rb
index 0b75febea9f024dbcb74a77760c28f61236e5f7c..9b547644ad80ea5b6be8bf4e0dcc6ad72f805270 100644 (file)
@@ -1,5 +1,3 @@
-require 'uri'
-
 class UrbanPlugin < Plugin
 
   def help( plugin, topic="")
@@ -18,7 +16,7 @@ class UrbanPlugin < Plugin
       end
     end
     # we give a very high 'skip' because this will allow us to get the number of definitions by retrieving the previous definition
-    uri = "http://www.urbanwap.com/search.php?term=#{URI.escape words}&skip=65536"
+    uri = "http://www.urbanwap.com/search.php?term=#{CGI.escape words}&skip=65536"
     page = @bot.httputil.get(uri)
     if page.nil?
       m.reply "Couldn't retrieve an urban dictionary definition of #{words}"
@@ -39,7 +37,7 @@ class UrbanPlugin < Plugin
       n = numdefs
     end
     if n < numdefs
-      uri = "http://www.urbanwap.com/search.php?term=#{URI.escape words}&skip=#{n-1}"
+      uri = "http://www.urbanwap.com/search.php?term=#{CGI.escape words}&skip=#{n-1}"
       page = @bot.httputil.get(uri)
       if page.nil?
         case n % 10