Class: Rubirai::ForwardMessage::Node
- Inherits:
-
Object
- Object
- Rubirai::ForwardMessage::Node
- Defined in:
- lib/rubirai/messages/message.rb
Overview
A message node in the forward message list
Instance Attribute Summary collapse
-
#message_chain ⇒ MessageChain
readonly
The message chain.
-
#sender_id ⇒ Integer
readonly
Sender id.
-
#sender_name ⇒ String
readonly
The sender name.
-
#time ⇒ Integer
readonly
Send timestamp (second).
Class Method Summary collapse
Instance Attribute Details
#message_chain ⇒ MessageChain (readonly)
Returns the message chain.
431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 |
# File 'lib/rubirai/messages/message.rb', line 431 class Node attr_reader :sender_id, :time, :sender_name, :message_chain # @private def initialize(hash, bot = nil) return unless hash @sender_id = hash['senderId'] @time = hash['time'] @sender_name = hash['senderName'] @message_chain = MessageChain.make(*hash['messageChain'], bot: bot) end def self.from(**kwargs) n = new({}) %i[sender_id time sender_name message_chain].each do |attr| n.instance_variable_set("@#{attr}", kwargs[attr]) end end end |
#sender_id ⇒ Integer (readonly)
Returns sender id.
431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 |
# File 'lib/rubirai/messages/message.rb', line 431 class Node attr_reader :sender_id, :time, :sender_name, :message_chain # @private def initialize(hash, bot = nil) return unless hash @sender_id = hash['senderId'] @time = hash['time'] @sender_name = hash['senderName'] @message_chain = MessageChain.make(*hash['messageChain'], bot: bot) end def self.from(**kwargs) n = new({}) %i[sender_id time sender_name message_chain].each do |attr| n.instance_variable_set("@#{attr}", kwargs[attr]) end end end |
#sender_name ⇒ String (readonly)
Returns the sender name.
431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 |
# File 'lib/rubirai/messages/message.rb', line 431 class Node attr_reader :sender_id, :time, :sender_name, :message_chain # @private def initialize(hash, bot = nil) return unless hash @sender_id = hash['senderId'] @time = hash['time'] @sender_name = hash['senderName'] @message_chain = MessageChain.make(*hash['messageChain'], bot: bot) end def self.from(**kwargs) n = new({}) %i[sender_id time sender_name message_chain].each do |attr| n.instance_variable_set("@#{attr}", kwargs[attr]) end end end |
#time ⇒ Integer (readonly)
Returns send timestamp (second).
431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 |
# File 'lib/rubirai/messages/message.rb', line 431 class Node attr_reader :sender_id, :time, :sender_name, :message_chain # @private def initialize(hash, bot = nil) return unless hash @sender_id = hash['senderId'] @time = hash['time'] @sender_name = hash['senderName'] @message_chain = MessageChain.make(*hash['messageChain'], bot: bot) end def self.from(**kwargs) n = new({}) %i[sender_id time sender_name message_chain].each do |attr| n.instance_variable_set("@#{attr}", kwargs[attr]) end end end |
Class Method Details
.from(**kwargs) ⇒ Object
443 444 445 446 447 448 |
# File 'lib/rubirai/messages/message.rb', line 443 def self.from(**kwargs) n = new({}) %i[sender_id time sender_name message_chain].each do |attr| n.instance_variable_set("@#{attr}", kwargs[attr]) end end |