Class: Rubirai::ForwardMessage::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/rubirai/messages/message.rb

Overview

A message node in the forward message list

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#message_chainMessageChain (readonly)

Returns the message chain.

Returns:



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_idInteger (readonly)

Returns sender id.

Returns:

  • (Integer)

    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_nameString (readonly)

Returns the sender name.

Returns:

  • (String)

    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

#timeInteger (readonly)

Returns send timestamp (second).

Returns:

  • (Integer)

    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