]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/factoids.rb
script plugin: hook on message() rather than listen()
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / factoids.rb
index aeb6557fc8d534d221f1fb2b90c2933c75bed0b0..3192aa00e450d211de79f7aa9a0cad1ca944a5ac 100644 (file)
@@ -331,7 +331,9 @@ class FactoidsPlugin < Plugin
     # When looking for words we separate them with
     # arbitrary whitespace, not whatever they came with
     pre = words.map { |w| Regexp.escape(w)}.join("\\s+")
-    return Regexp.new("\\b#{pre}\\b", true)
+    pre << '\b' if pre.match(/\b$/)
+    pre = '\b' + pre if pre.match(/^\b/)
+    return Regexp.new(pre, true)
   end
 
   def facts(m, params)