- def help(plugin, topic="")
- "chucknorris [<howmany>=1] => show a random chuck norris quote, or specify <howmany> quotes you want (maximum is 6)."
+ # Loadez les factes
+ def initialize
+ if path = find_facts_file('chucknorris.yml.gz')
+ fyml = Zlib::GzipReader.open(path)
+ elsif path = find_facts_File('chucknorris.yml')
+ fyml = open(path)
+ else
+ raise "Error: Couldn't find chucknorris.yml[.gz]"
+ end
+
+ debug "+ [chucknorris] Loading #{path}..."
+
+ @@facts = YAML.load(fyml).map{|fact,(score,votes)| votes >= MIN_VOTES ? [score,fact] : nil}.compact
+ debug "+ [chucknorris] #{@@facts.length} Chuck Norris facts loaded..."
+ debug " Random fact: #{@@facts[rand(@@facts.size)].inspect}"
+
+ super