Class: MTProto::TL::SendBotRequestedPeer

Inherits:
Object
  • Object
show all
Includes:
Binary
Defined in:
lib/mtproto/tl/objects/send_bot_requested_peer.rb

Constant Summary collapse

CONSTRUCTOR =
0x6c5cf2a7

Instance Method Summary collapse

Methods included from Binary

#b_u32, #b_u64, #u32_b, #u64_b

Constructor Details

#initialize(peer:, button_id:, msg_id: nil, requested_peers: []) ⇒ SendBotRequestedPeer

peer / requested_peers entries: { type:, id:, access_hash: } or { type: :self }



11
12
13
14
15
16
# File 'lib/mtproto/tl/objects/send_bot_requested_peer.rb', line 11

def initialize(peer:, button_id:, msg_id: nil, requested_peers: [])
  @peer = peer
  @button_id = button_id
  @msg_id = msg_id
  @requested_peers = requested_peers
end

Instance Method Details

#serializeObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/mtproto/tl/objects/send_bot_requested_peer.rb', line 18

def serialize
  flags = 0
  flags |= (1 << 0) if @msg_id

  result = u32_b(CONSTRUCTOR)
  result += u32_b(flags)
  result += serialize_input_peer(@peer)
  result += u32_b(@msg_id) if @msg_id
  result += u32_b(@button_id)
  result += u32_b(Constructors::VECTOR)
  result += u32_b(@requested_peers.size)
  @requested_peers.each { |peer| result += serialize_input_peer(peer) }
  result
end