# TODO: cache results and reuse them if get_cached returns a cache copy\r
\r
DEMAURO_LEMMA = /<anchor>(.*?)(?: - (.*?))<go href="lemma.php\?ID=(\d+)"\/><\/anchor>/\r
+CHAMBERS_LEMMA = /<p><span class="hwd">(.*?)<\/span> <span class="psa">(.*?)<\/span>(.*?)<\/p>/\r
\r
class DictPlugin < Plugin\r
BotConfig.register BotConfigIntegerValue.new('dict.hits',\r
when /No exact matches for <b>.*?<\/b>, but the following may be helpful./\r
return false if justcheck\r
m.reply "Nothing found for #{word}, but see #{url} for possible suggestions"\r
- else\r
- return true if justcheck\r
- m.reply "#{word}: #{url}"\r
+ return\r
end\r
+ # Else, we have a hit\r
+ return true if justcheck\r
+ m.reply "#{word}: #{url}"\r
+ entries = xml.scan(CHAMBERS_LEMMA)\r
+ hits = @bot.config['dict.hits']\r
+ entries[0...hits].map { |ar|\r
+ m.reply(("#{Bold}%s#{Bold} #{Underline}%s#{Underline}%s" % ar).ircify_html, :overlong => :truncate)\r
+ }\r
end\r
\r
def is_english?(word)\r