Class: MTProto::TL::SetBotInfo

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

Constant Summary collapse

CONSTRUCTOR =
0x10cf3123
INPUT_USER =
0xf21158c6
INPUT_USER_SELF =
0xf7c1b13f

Instance Method Summary collapse

Methods included from Binary

#b_u32, #b_u64, #u32_b, #u64_b

Constructor Details

#initialize(bot: nil, lang_code: '', name: nil, about: nil, description: nil) ⇒ SetBotInfo

bot: { id:, access_hash: } or { type: :self } (nil = the calling bot)



13
14
15
16
17
18
19
# File 'lib/mtproto/tl/objects/set_bot_info.rb', line 13

def initialize(bot: nil, lang_code: '', name: nil, about: nil, description: nil)
  @bot = bot
  @lang_code = lang_code
  @name = name
  @about = about
  @description = description
end

Instance Method Details

#serializeObject



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

def serialize
  flags = 0
  flags |= (1 << 2) if @bot
  flags |= (1 << 3) if @name
  flags |= (1 << 0) if @about
  flags |= (1 << 1) if @description

  result = u32_b(CONSTRUCTOR)
  result += u32_b(flags)
  result += serialize_input_user(@bot) if @bot
  result += serialize_tl_string(@lang_code)
  result += serialize_tl_string(@name) if @name
  result += serialize_tl_string(@about) if @about
  result += serialize_tl_string(@description) if @description
  result
end