Class: Nico::Message
- Inherits:
-
Object
- Object
- Nico::Message
- Defined in:
- lib/nico/message.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
Instance Method Summary collapse
-
#initialize(json) ⇒ Message
constructor
A new instance of Message.
- #relevant? ⇒ Boolean
- #response ⇒ Object
Constructor Details
#initialize(json) ⇒ Message
Returns a new instance of Message.
8 9 10 11 |
# File 'lib/nico/message.rb', line 8 def initialize(json) # also available: id, user_id, starred, created_at, type, room_id @body = json['body'] || '' end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
6 7 8 |
# File 'lib/nico/message.rb', line 6 def body @body end |
Instance Method Details
#relevant? ⇒ Boolean
13 14 15 |
# File 'lib/nico/message.rb', line 13 def relevant? @body.start_with? *Nico::ALIASES end |
#response ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/nico/message.rb', line 17 def response # This should loop through the regex and respond adequately # And one of these regex will add to the regex (and save to github) case @body when Matchers::DaftPunkMatcher.match then Matchers::DaftPunkMatcher.response else "You said #{@body}" end end |