]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
factoids: pass proper parameter from unreplied()
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Mon, 16 Feb 2009 22:57:10 +0000 (23:57 +0100)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Mon, 16 Feb 2009 22:57:10 +0000 (23:57 +0100)
When passing on the Array of split words from unreplied() to facts()
make sure that the passed argument behaves like an Array/String from
the MessageMapper.

data/rbot/plugins/factoids.rb

index 689b6d78e688d23e5a428f07ae5bdc860a96119e..5b5e2b7204f7bea44d388268a80a897b21ed5411 100644 (file)
@@ -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