Class: Nanobot::Bus::InboundMessage
- Inherits:
-
Struct
- Object
- Struct
- Nanobot::Bus::InboundMessage
- Defined in:
- lib/nanobot/bus/events.rb
Overview
InboundMessage represents a message coming into the system from a channel
Instance Attribute Summary collapse
-
#channel ⇒ Object
Returns the value of attribute channel.
-
#chat_id ⇒ Object
Returns the value of attribute chat_id.
-
#content ⇒ Object
Returns the value of attribute content.
-
#media ⇒ Object
Returns the value of attribute media.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#sender_id ⇒ Object
Returns the value of attribute sender_id.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
Instance Method Summary collapse
-
#initialize(channel:, sender_id:, chat_id:, content:, **opts) ⇒ InboundMessage
constructor
A new instance of InboundMessage.
-
#session_key ⇒ String
Generates a unique session key combining channel and chat_id.
Constructor Details
#initialize(channel:, sender_id:, chat_id:, content:, **opts) ⇒ InboundMessage
Returns a new instance of InboundMessage.
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/nanobot/bus/events.rb', line 23 def initialize(channel:, sender_id:, chat_id:, content:, **opts) super( channel: channel, sender_id: sender_id, chat_id: chat_id, content: content, timestamp: opts[:timestamp] || Time.now, media: opts[:media] || [], metadata: opts[:metadata] || {} ) end |
Instance Attribute Details
#channel ⇒ Object
Returns the value of attribute channel
8 9 10 |
# File 'lib/nanobot/bus/events.rb', line 8 def channel @channel end |
#chat_id ⇒ Object
Returns the value of attribute chat_id
8 9 10 |
# File 'lib/nanobot/bus/events.rb', line 8 def chat_id @chat_id end |
#content ⇒ Object
Returns the value of attribute content
8 9 10 |
# File 'lib/nanobot/bus/events.rb', line 8 def content @content end |
#media ⇒ Object
Returns the value of attribute media
8 9 10 |
# File 'lib/nanobot/bus/events.rb', line 8 def media @media end |
#metadata ⇒ Object
Returns the value of attribute metadata
8 9 10 |
# File 'lib/nanobot/bus/events.rb', line 8 def @metadata end |
#sender_id ⇒ Object
Returns the value of attribute sender_id
8 9 10 |
# File 'lib/nanobot/bus/events.rb', line 8 def sender_id @sender_id end |
#timestamp ⇒ Object
Returns the value of attribute timestamp
8 9 10 |
# File 'lib/nanobot/bus/events.rb', line 8 def @timestamp end |
Instance Method Details
#session_key ⇒ String
Generates a unique session key combining channel and chat_id
37 38 39 |
# File 'lib/nanobot/bus/events.rb', line 37 def session_key "#{channel}:#{chat_id}" end |