X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Ffactoids.rb;h=3192aa00e450d211de79f7aa9a0cad1ca944a5ac;hb=1e841175468b3e0357ab278a226a237fe4d7687e;hp=cba09b983696e4c02bbebb8eb8f21933457b180b;hpb=7ab8fc67ca91322898327aed1a920f5bddbdab90;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/factoids.rb b/data/rbot/plugins/factoids.rb index cba09b98..3192aa00 100644 --- a/data/rbot/plugins/factoids.rb +++ b/data/rbot/plugins/factoids.rb @@ -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