Class: MTProto::TL::UploadProfilePhoto

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

Constant Summary collapse

CONSTRUCTOR =
0x0388a3b5
INPUT_USER =
0xf21158c6
INPUT_USER_SELF =
0xf7c1b13f
INPUT_FILE =
0xf52ff27f

Instance Method Summary collapse

Methods included from Binary

#b_u32, #b_u64, #u32_b, #u64_b

Constructor Details

#initialize(file:, bot: nil) ⇒ UploadProfilePhoto

bot: { id:, access_hash: } or { type: :self }; nil targets the calling bot file: { id:, parts:, name:, md5_checksum: }



15
16
17
18
# File 'lib/mtproto/tl/objects/upload_profile_photo.rb', line 15

def initialize(file:, bot: nil)
  @bot = bot
  @file = file
end

Instance Method Details

#serializeObject



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

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

  result = u32_b(CONSTRUCTOR)
  result += u32_b(flags)
  result += serialize_input_user(@bot) if @bot
  result += serialize_input_file(@file)
  result
end