Class: ICQ::Event
- Inherits:
-
Object
- Object
- ICQ::Event
- Defined in:
- lib/icqbot/event.rb
Instance Attribute Summary collapse
-
#chat_id ⇒ Object
readonly
Returns the value of attribute chat_id.
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#msg_id ⇒ Object
readonly
Returns the value of attribute msg_id.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(event_h) ⇒ Event
constructor
A new instance of Event.
- #prefix? ⇒ Boolean
- #to_h ⇒ Object
Constructor Details
#initialize(event_h) ⇒ Event
Returns a new instance of Event.
16 17 18 19 20 21 22 23 |
# File 'lib/icqbot/event.rb', line 16 def initialize event_h @event_h = event_h @type = event_h['type'] @text = event_h['payload']['text'] @msg_id = event_h['payload']['msgId'] @chat_id = event_h['payload']['chat']['chatId'] @from = event_h['payload']['from'] end |
Instance Attribute Details
#chat_id ⇒ Object (readonly)
Returns the value of attribute chat_id.
14 15 16 |
# File 'lib/icqbot/event.rb', line 14 def chat_id @chat_id end |
#from ⇒ Object (readonly)
Returns the value of attribute from.
14 15 16 |
# File 'lib/icqbot/event.rb', line 14 def from @from end |
#msg_id ⇒ Object (readonly)
Returns the value of attribute msg_id.
14 15 16 |
# File 'lib/icqbot/event.rb', line 14 def msg_id @msg_id end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
14 15 16 |
# File 'lib/icqbot/event.rb', line 14 def text @text end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
14 15 16 |
# File 'lib/icqbot/event.rb', line 14 def type @type end |
Instance Method Details
#prefix? ⇒ Boolean
25 26 27 |
# File 'lib/icqbot/event.rb', line 25 def prefix? @text[0] == ICQ::BOT_PREFIX end |
#to_h ⇒ Object
29 |
# File 'lib/icqbot/event.rb', line 29 def to_h; @event_h end |