Class: FuncBot::Bots::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/func_bot/bots/message.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(role, content, name = nil) ⇒ Message

Returns a new instance of Message.



6
7
8
9
10
# File 'lib/func_bot/bots/message.rb', line 6

def initialize(role, content, name = nil)
  @role = role
  @content = content
  @name = name
end

Instance Attribute Details

#contentObject

Returns the value of attribute content.



4
5
6
# File 'lib/func_bot/bots/message.rb', line 4

def content
  @content
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/func_bot/bots/message.rb', line 4

def name
  @name
end

#roleObject

Returns the value of attribute role.



4
5
6
# File 'lib/func_bot/bots/message.rb', line 4

def role
  @role
end

Instance Method Details

#dataObject



12
13
14
15
16
17
18
# File 'lib/func_bot/bots/message.rb', line 12

def data
  if name.nil?
    {role: role, content: content}
  else
    {role: role, content: content, name: name}
  end
end