Class: MTProto::TL::RequestPeerTypeCreateBot

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

Constant Summary collapse

CONSTRUCTOR =
0x3e81e078

Instance Method Summary collapse

Methods included from Binary

#b_u32, #b_u64, #u32_b, #u64_b

Constructor Details

#initialize(bot_managed: true, suggested_name: nil, suggested_username: nil) ⇒ RequestPeerTypeCreateBot

Returns a new instance of RequestPeerTypeCreateBot.



10
11
12
13
14
# File 'lib/mtproto/tl/objects/request_peer_type_create_bot.rb', line 10

def initialize(bot_managed: true, suggested_name: nil, suggested_username: nil)
  @bot_managed = bot_managed
  @suggested_name = suggested_name
  @suggested_username = suggested_username
end

Instance Method Details

#serializeObject



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/mtproto/tl/objects/request_peer_type_create_bot.rb', line 16

def serialize
  flags = 0
  flags |= (1 << 0) if @bot_managed
  flags |= (1 << 1) if @suggested_name
  flags |= (1 << 2) if @suggested_username

  result = u32_b(CONSTRUCTOR)
  result += u32_b(flags)
  result += serialize_tl_string(@suggested_name) if @suggested_name
  result += serialize_tl_string(@suggested_username) if @suggested_username
  result
end