Class: MTProto::TL::GetBotInfo

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

Overview

bots.getBotInfo — read a bot's name/about/description for a language. Returns bots.botInfo. Result parsing belongs to a later layer; this object only builds the request.

Constant Summary collapse

CONSTRUCTOR =
0xdcd914fd
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: '') ⇒ GetBotInfo

bot: { id:, access_hash: } or { type: :self }; nil targets the calling bot



16
17
18
19
# File 'lib/mtproto/tl/objects/get_bot_info.rb', line 16

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

Instance Method Details

#serializeObject



21
22
23
24
25
26
27
28
29
30
# File 'lib/mtproto/tl/objects/get_bot_info.rb', line 21

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

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