diff options
-rw-r--r-- | lib/rbot/ircbot.rb | 6 | ||||
-rw-r--r-- | lib/rbot/message.rb | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb index 3cd0cae8..932cc3b7 100644 --- a/lib/rbot/ircbot.rb +++ b/lib/rbot/ircbot.rb @@ -914,6 +914,12 @@ class Bot end multi_line = original_message.to_s.gsub(/[\r\n]+/, "\n") + + # if target is a channel with +c or +C modes, strip colours + if where.kind_of?(Channel) and where.mode.any?('c', 'C') + multi_line.replace(BasicUserMessage.stripcolour(multi_line).gsub(AttributeRx,'')) + end + messages = Array.new case opts[:newlines] when :join diff --git a/lib/rbot/message.rb b/lib/rbot/message.rb index fddbef5f..abe53ce0 100644 --- a/lib/rbot/message.rb +++ b/lib/rbot/message.rb @@ -33,6 +33,7 @@ module Irc Reverse = "\026" Italic = "\011" NormalText = "\017" + AttributeRx = /#{Bold}|#{Underline}|#{Reverse}|#{Italic}|#{NormalText}/ # Color is prefixed by \003 and followed by optional # foreground and background specifications, two-digits-max |