]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/quotes.rb
plugin(points): strip/ignore some terms closes #34
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / quotes.rb
index 59234e705a4b289a7e4ab98ad10c19f37a2903aa..c10666899b0024369f04f2610b87d6e358d6b90b 100644 (file)
@@ -16,7 +16,7 @@ class QuotePlugin < Plugin
     super
     @lists = Hash.new
     @changed = Hash.new
-    Dir[datafile '*'].each {|f|
+    Dir[datafile('*')].each {|f|
       next if File.directory?(f)
       channel = File.basename(f)
       @lists[channel] = Array.new if(!@lists.has_key?(channel))
@@ -36,7 +36,7 @@ class QuotePlugin < Plugin
       begin
         if @changed[channel]
           debug "Writing new quotefile for channel #{channel} ..."
-          Utils.safe_save(datafile channel) {|file|
+          Utils.safe_save(datafile(channel)) {|file|
             quotes.compact.each {|q|
               file.puts "#{q.num} | #{q.date} | #{q.source} | #{q.quote}"
             }
@@ -80,7 +80,7 @@ class QuotePlugin < Plugin
       end
     else
       # random quote
-      return @lists[channel].compact[rand(@lists[channel].nitems)],
+      return @lists[channel].compact.pick_one,
       @lists[channel].length - 1
     end
   end