Class: MTProto::TL::UploadMedia

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

Overview

messages.uploadMedia — hand Telegram an upload and get back the photo it now holds.

The step before an album: a group is sent by naming photos Telegram already has, so each file is offered once on its own before the group is sent at all.

Constant Summary collapse

CONSTRUCTOR =
0x14967978

Constants included from MediaParts

MediaParts::INPUT_MEDIA_PHOTO, MediaParts::INPUT_PHOTO

Instance Method Summary collapse

Methods included from MediaParts

#serialize_byte_array, #serialize_file, #serialize_held_photo, #serialize_peer, #serialize_raw, #serialize_text, #serialize_uploaded_photo

Methods included from Binary

#b_u32, #b_u64, #u32_b, #u64_b

Constructor Details

#initialize(peer:, file:) ⇒ UploadMedia

Returns a new instance of UploadMedia.



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

def initialize(peer:, file:)
  @peer = peer
  @file = file
end

Instance Method Details

#serializeObject



21
22
23
# File 'lib/mtproto/tl/objects/upload_media.rb', line 21

def serialize
  u32_b(CONSTRUCTOR) + u32_b(0) + serialize_peer(@peer) + serialize_uploaded_photo(@file)
end