]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/factoids.rb
karma: prevent users from changing own karma
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / factoids.rb
index 689b6d78e688d23e5a428f07ae5bdc860a96119e..0970684fda98ee8d86b455c18c67408a44c8e7ee 100644 (file)
@@ -341,7 +341,7 @@ class FactoidsPlugin < Plugin
     if params[:words].nil_or_empty? and params[:rx].nil_or_empty?
       m.reply _("I know %{total} facts" % { :total => total })
     else
-      if params[:words].empty?
+      unless params.key? :words and not params[:words].empty?
         rx = Regexp.new(params[:rx].to_s, true)
       else
         rx = words2rx(params[:words])
@@ -379,7 +379,12 @@ class FactoidsPlugin < Plugin
       return if @triggers.empty?
       query = $1.strip.downcase
       if @triggers.include?(query)
-        facts(m, :words => query.split)
+        words = query.split
+        words.instance_variable_set(:@string_value, query)
+        def words.to_s
+          @string_value
+        end
+        facts(m, :words => words)
       end
     else
       return if m.address? # we don't learn stuff directed at us which is not an explicit learn command