diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-11-21 21:41:18 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-11-21 21:41:18 +0000 |
commit | d15f68939a662b106b27ee4f4d5ba5501142e632 (patch) | |
tree | 7090451c350558e063b171bfa961e3104b934304 /data/rbot | |
parent | 084dd243f8d92f683a0fc6c3f8e12fae3e7bd77a (diff) |
factoids plugin: reply when queries match a trigger
Diffstat (limited to 'data/rbot')
-rw-r--r-- | data/rbot/plugins/factoids.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/data/rbot/plugins/factoids.rb b/data/rbot/plugins/factoids.rb index ca95d003..a66c0f52 100644 --- a/data/rbot/plugins/factoids.rb +++ b/data/rbot/plugins/factoids.rb @@ -187,7 +187,7 @@ class FactoidsPlugin < Plugin i = a.last m = r.match(f.to_s) if m - list << m[i] + list << m[i].downcase else list end @@ -301,6 +301,16 @@ class FactoidsPlugin < Plugin end end + def unreplied(m) + return if @factoids.empty? + return if @triggers.empty? + return unless m.message =~ /^(.*)\?\s*$/ + query = $1.strip.downcase + if @triggers.include?(query) + facts(m, :words => query) + end + end + def fact(m, params) fact = nil idx = 0 |