Class: Nanobot::Bus::OutboundMessage

Inherits:
Struct
  • Object
show all
Defined in:
lib/nanobot/bus/events.rb

Overview

OutboundMessage represents a message going out from the system to a channel

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(channel:, chat_id:, content:, reply_to: nil, media: nil, metadata: nil) ⇒ OutboundMessage

Returns a new instance of OutboundMessage.

Parameters:

  • channel (String) —

    target channel name

  • chat_id (String) —

    target chat/conversation ID

  • content (String) —

    message text content

  • reply_to (String, nil) (defaults to: nil) —

    ID of message being replied to

  • media (Array, nil) (defaults to: nil) —

    media attachments

  • metadata (Hash, nil) (defaults to: nil) —

    additional metadata



58
59
60
61
62
63
64
65
66
67
# File 'lib/nanobot/bus/events.rb', line 58

def initialize(channel:, chat_id:, content:, reply_to: nil, media: nil, metadata: nil)
  super(
    channel: channel,
    chat_id: chat_id,
    content: content,
    reply_to: reply_to,
    media: media || [],
    metadata:  || {}
  )
end

Instance Attribute Details

#channel ⇒ Object

Returns the value of attribute channel

Returns:

  • (Object) —

    the current value of channel



43
44
45
# File 'lib/nanobot/bus/events.rb', line 43

def channel
  @channel
end

#chat_id ⇒ Object

Returns the value of attribute chat_id

Returns:

  • (Object) —

    the current value of chat_id



43
44
45
# File 'lib/nanobot/bus/events.rb', line 43

def chat_id
  @chat_id
end

#content ⇒ Object

Returns the value of attribute content

Returns:

  • (Object) —

    the current value of content



43
44
45
# File 'lib/nanobot/bus/events.rb', line 43

def content
  @content
end

#media ⇒ Object

Returns the value of attribute media

Returns:

  • (Object) —

    the current value of media



43
44
45
# File 'lib/nanobot/bus/events.rb', line 43

def media
  @media
end

#metadata ⇒ Object

Returns the value of attribute metadata

Returns:

  • (Object) —

    the current value of metadata



43
44
45
# File 'lib/nanobot/bus/events.rb', line 43

def 
  @metadata
end

#reply_to ⇒ Object

Returns the value of attribute reply_to

Returns:

  • (Object) —

    the current value of reply_to



43
44
45
# File 'lib/nanobot/bus/events.rb', line 43

def reply_to
  @reply_to
end