Class | ::BasicUserMessage |
In: |
lib/rbot/core/utils/extends.rb
|
Parent: | Object |
We extend the BasicUserMessage class with a method that parses a string which is a channel list as matched by IN_CHAN(_LIST) and co. The method returns an array of channel names, where ‘private’ or ‘pvt’ is replaced by the Symbol :"?", ‘here’ is replaced by the channel of the message or by :"?" (depending on whether the message target is the bot or a Channel), and ‘anywhere’ and ‘everywhere’ are replaced by Symbol :*
# File lib/rbot/core/utils/extends.rb, line 421 421: def parse_channel_list(string) 422: return [:*] if [:anywhere, :everywhere].include? string.to_sym 423: string.scan( 424: /(?:^|,?(?:\s+and)?\s+)(?:in|on\s+)?(#{Regexp::Irc::GEN_CHAN}|here|private|pvt)/ 425: ).map { |chan_ar| 426: chan = chan_ar.first 427: case chan.to_sym 428: when :private, :pvt 429: "?""?" 430: when :here 431: case self.target 432: when Channel 433: self.target.name 434: else 435: "?""?" 436: end 437: else 438: chan 439: end 440: }.uniq 441: end
The recurse depth of a message, for fake messages. 0 means an original message
# File lib/rbot/core/utils/extends.rb, line 445 445: def recurse_depth 446: unless defined? @recurse_depth 447: @recurse_depth = 0 448: end 449: @recurse_depth 450: end