Class: CampfireBot::Event::Command
- Inherits:
-
EventHandler
- Object
- EventHandler
- CampfireBot::Event::Command
- Defined in:
- lib/event.rb
Instance Attribute Summary
Attributes inherited from EventHandler
#kind, #matcher, #method, #plugin
Instance Method Summary collapse
Methods inherited from EventHandler
Constructor Details
This class inherits a constructor from CampfireBot::Event::EventHandler
Instance Method Details
#match?(msg) ⇒ Boolean
37 38 39 40 41 42 43 44 |
# File 'lib/event.rb', line 37 def match?(msg) ( msg[:message][0..0] == '!' || msg[:message] =~ Regexp.new("^#{bot.config['nickname']}(,|:)", Regexp::IGNORECASE) ) && msg[:message].gsub(/^\!/, '').gsub(Regexp.new("^#{bot.config['nickname']}(,|:)?\\s*", Regexp::IGNORECASE), '').split(' ')[0].to_s.downcase == @matcher.downcase # FIXME - the above should be just done with one regexp to pull out the first non-! non-<bot name> word. end |