]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/linkbot.rb
alias plugin: don't create data path if it already exists
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / linkbot.rb
index a922883f44a46b1a4ce54e674ac9dbddd82cb80f..6a5cafbce728967292d854125ce84ccae90e0b33 100644 (file)
 # servers to make this even easier.
 
 class LinkBot < Plugin
-  BotConfig.register BotConfigArrayValue.new('linkbot.nicks',
+  Config.register Config::ArrayValue.new('linkbot.nicks',
     :default => [],
     :desc => "Nick(s) of the bots that act as channel links across networks")
 
-  BotConfig.register BotConfigArrayValue.new('linkbot.message_patterns',
+  Config.register Config::ArrayValue.new('linkbot.message_patterns',
     :default => ['^<(\S+?)@(\S+?)>\s+(.*)$', '^\((\S+?)@(\S+?)\)\s+(.*)$'],
     :desc => "List of regexp which match linkbot messages; each regexp needs to have three captures, which in order are the nickname of the original speaker, network, and original message")
   # TODO use template strings instead of regexp for user friendliness
@@ -48,7 +48,8 @@ class LinkBot < Plugin
     return unless m.kind_of?(PrivMessage)
     # Now we know that _m_ is a PRIVMSG from a linkbot. Let's split it
     # in nick, network, message
-    if @message_patterns.any? {|p| m.message.match p}
+    message = BasicUserMessage.stripcolour m.message
+    if @message_patterns.any? {|p| message =~ p}
       # if the regexp doesn't contain all parts, the default values get used
       new_nick = $1 || 'unknown_nick'
       network = $2 || 'unknown_network'