]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - lib/rbot/messagemapper.rb
remotectl plugin: use fake_message()
[user/henk/code/ruby/rbot.git] / lib / rbot / messagemapper.rb
index 7f13b7fbb78bebaf08c4acef54063af2b7485f4c..87bdd01f6e7150b2630848ce98cc6bca0eec111a 100644 (file)
@@ -18,6 +18,7 @@ class Regexp
 end
 
 module Irc
+class Bot
 
   # MessageMapper is a class designed to reduce the amount of regexps and
   # string parsing plugins and bot modules need to do, in order to process
@@ -192,7 +193,14 @@ module Irc
           if m.bot.auth.allow?(auth, m.source, m.replyto)
             debug "template match found and auth'd: #{action.inspect} #{options.inspect}"
             if tmpl.options[:thread] || tmpl.options[:threaded]
-              Thread.new { @parent.send(action, m, options) }
+              Thread.new do
+                begin
+                  @parent.send(action, m, options)
+                rescue Exception => e
+                  error "In threaded action: #{e.message}"
+                  debug e.backtrace.join("\n")
+                end
+              end
             else
               @parent.send(action, m, options)
             end
@@ -412,6 +420,7 @@ module Irc
           end
           pre = nil if extra.sub!(/^!/, "")
           post = nil if extra.sub!(/!$/, "")
+          extra = nil if extra.empty?
         else
           extra = nil
         end
@@ -586,3 +595,4 @@ module Irc
     end
   end
 end
+end