Class: MTProto::TL::InputKeyboardButtonRequestPeer

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

Constant Summary collapse

CONSTRUCTOR =
0x02b78156

Instance Method Summary collapse

Methods included from Binary

#b_u32, #b_u64, #u32_b, #u64_b

Constructor Details

#initialize(text:, button_id:, peer_type:, max_quantity: 1, name_requested: false, username_requested: false, photo_requested: false) ⇒ InputKeyboardButtonRequestPeer

Returns a new instance of InputKeyboardButtonRequestPeer.



10
11
12
13
14
15
16
17
18
19
# File 'lib/mtproto/tl/objects/input_keyboard_button_request_peer.rb', line 10

def initialize(text:, button_id:, peer_type:, max_quantity: 1,
               name_requested: false, username_requested: false, photo_requested: false)
  @text = text
  @button_id = button_id
  @peer_type = peer_type
  @max_quantity = max_quantity
  @name_requested = name_requested
  @username_requested = username_requested
  @photo_requested = photo_requested
end

Instance Method Details

#serializeObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/mtproto/tl/objects/input_keyboard_button_request_peer.rb', line 21

def serialize
  flags = 0
  flags |= (1 << 0) if @name_requested
  flags |= (1 << 1) if @username_requested
  flags |= (1 << 2) if @photo_requested

  result = u32_b(CONSTRUCTOR)
  result += u32_b(flags)
  result += serialize_tl_string(@text)
  result += u32_b(@button_id)
  result += @peer_type.serialize
  result += u32_b(@max_quantity)
  result
end