]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/dict.rb
dict plugin: echo oxford definitions
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / dict.rb
index 245b48a461724ac54a4be967bbcb8e6376e54022..6d35bd651b496dd2bbe1029925fa70f8b76878fb 100644 (file)
@@ -111,9 +111,11 @@ class DictPlugin < Plugin
       if params[:british]\r
         url << "?view=uk"\r
       end\r
-      h = @bot.httputil.head(url, :max_redir => 5)\r
-      if h\r
-        m.reply("#{word} found: #{url}") unless justcheck\r
+      h = @bot.httputil.get(url, :max_redir => 5)\r
+      if h and h.match(%r!<h2>#{word}(?:<sup>1</sup>)?</h2>!)\r
+        m.reply("#{word} : #{url}") unless justcheck\r
+        defn = $'\r
+        m.reply("#{Bold}%s#{Bold}: %s" % [word, defn.ircify_html], :overlong => :truncate)\r
         return true\r
       end\r
     }\r