class Rubirai::QuoteMessage

The quote message type

Public Class Methods

new(hash, bot = nil) click to toggle source

@private

Calls superclass method Rubirai::Message::new
# File lib/rubirai/messages/message.rb, line 247
def initialize(hash, bot = nil)
  super :Quote, bot
  @id = hash['id']
  @group_id = hash['groupId']
  @sender_id = hash['senderId']
  @target_id = hash['targetId']
  @origin = MessageChain.make(*hash['origin'], bot: bot)
  @origin_raw = hash['origin']
end

Public Instance Methods

to_h() click to toggle source
# File lib/rubirai/messages/message.rb, line 257
def to_h
  {
    'type' => 'Quote',
    'id' => @id,
    'groupId' => @group_id,
    'senderId' => @sender_id,
    'targetId' => @target_id,
    'origin' => @origin_raw || @origin.to_a
  }.compact
end