diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-09-18 12:06:53 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-09-18 12:06:53 +0000 |
commit | 7ab3595d60d2232b003049686403ee8add8e547d (patch) | |
tree | 11bec85189253f74add68137bb5e9318012e4723 /data/rbot | |
parent | 04a1aab1c40c7b2754940998e2e6ec290fc19e0d (diff) |
dict plugin: echo oxford definitions
Diffstat (limited to 'data/rbot')
-rw-r--r-- | data/rbot/plugins/dict.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/data/rbot/plugins/dict.rb b/data/rbot/plugins/dict.rb index 245b48a4..6d35bd65 100644 --- a/data/rbot/plugins/dict.rb +++ b/data/rbot/plugins/dict.rb @@ -111,9 +111,11 @@ class DictPlugin < Plugin if params[:british]
url << "?view=uk"
end
- h = @bot.httputil.head(url, :max_redir => 5)
- if h
- m.reply("#{word} found: #{url}") unless justcheck
+ h = @bot.httputil.get(url, :max_redir => 5)
+ if h and h.match(%r!<h2>#{word}(?:<sup>1</sup>)?</h2>!)
+ m.reply("#{word} : #{url}") unless justcheck
+ defn = $'
+ m.reply("#{Bold}%s#{Bold}: %s" % [word, defn.ircify_html], :overlong => :truncate)
return true
end
}
|