X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Fdict.rb;h=ca5f25882147c94cb7c268cb5d27e31dda216fa6;hb=9a565bfd48c59ac9c1b37d5afe9b8640889632ff;hp=be7923a28b9848e38d57e91a223e1fba6b22c724;hpb=b300dc765bdc74f77705a92092d5a36ec234b187;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/dict.rb b/data/rbot/plugins/dict.rb index be7923a2..ca5f2588 100644 --- a/data/rbot/plugins/dict.rb +++ b/data/rbot/plugins/dict.rb @@ -108,9 +108,14 @@ class DictPlugin < Plugin word = params[:word].join [word, word + "_1"].each { |check| url = @oxurl % CGI.escape(check) - h = @bot.httputil.head(url, :max_redir => 5) - if h - m.reply("#{word} found: #{url}") unless justcheck + if params[:british] + url << "?view=uk" + end + h = @bot.httputil.get(url, :max_redir => 5) + if h and h.match(%r!

#{word}(?:1)?

!) + m.reply("#{word} : #{url}") unless justcheck + defn = $' + m.reply("#{Bold}%s#{Bold}: %s" % [word, defn.ircify_html(:nbsp => :space)], :overlong => :truncate) return true end } @@ -119,7 +124,7 @@ class DictPlugin < Plugin end def is_british?(word) - return oxford(nil, :word => word, :justcheck => true) + return oxford(nil, :word => word, :justcheck => true, :british => true) end