]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/factoids.rb
plugins: raise a descriptive LoadError when the db is corrupt on load
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / factoids.rb
index cba09b983696e4c02bbebb8eb8f21933457b180b..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)
@@ -366,7 +368,7 @@ class FactoidsPlugin < Plugin
           reply << short_fact(f)
         }
       end
-      m.reply reply.join(". "), :split_at => /\s+--\s+/
+      m.reply reply.join(". "), :split_at => /\[\d+\/\d+\] /, :purge_split => false
     end
   end