def write(self) -> bytes: data = BytesIO() data.write(Int(self.ID, False)) # No flags data.write(self.peer.write()) data.write(Int(self.reply_to_msg_id)) data.write(Long(self.random_id)) return data.getvalue()
def write(self) -> bytes: data = BytesIO() data.write(Int(self.ID, False)) # No flags data.write(self.stickerset.write()) data.write(Long(self.volume_id)) data.write(Int(self.local_id)) return data.getvalue()
def write(self) -> bytes: data = BytesIO() data.write(Int(self.ID, False)) # No flags data.write(Long(self.query_id)) data.write(self.data.write()) data.write(Int(self.timeout)) return data.getvalue()
def write(self) -> bytes: data = BytesIO() data.write(Int(self.ID, False)) # No flags data.write(Long(self.poll_id)) data.write(Int(self.user_id)) data.write(Vector(self.options, Bytes)) return data.getvalue()
def write(self) -> bytes: data = BytesIO() data.write(Int(self.ID, False)) # No flags data.write(Long(self.answer_msg_id)) data.write(Int(self.bytes)) data.write(Int(self.status)) return data.getvalue()
def read(data: BytesIO, *args: Any) -> "MessageActionPhoneCall": flags = Int.read(data) video = True if flags & (1 << 2) else False call_id = Long.read(data) reason = TLObject.read(data) if flags & (1 << 0) else None duration = Int.read(data) if flags & (1 << 1) else None return MessageActionPhoneCall(call_id=call_id, video=video, reason=reason, duration=duration)
def write(self) -> bytes: data = BytesIO() data.write(Int(self.ID, False)) # No flags data.write(String(self.format)) data.write(self.theme.write()) data.write(Long(self.document_id)) return data.getvalue()
def read(data: BytesIO, *args: Any) -> "PageBlockVideo": flags = Int.read(data) autoplay = True if flags & (1 << 0) else False loop = True if flags & (1 << 1) else False video_id = Long.read(data) caption = TLObject.read(data) return PageBlockVideo(video_id=video_id, caption=caption, autoplay=autoplay, loop=loop)
def write(self) -> bytes: data = BytesIO() data.write(Int(self.ID, False)) # No flags data.write(Long(self.document_id)) data.write(Int(self.w)) data.write(Int(self.h)) return data.getvalue()
def read(data: BytesIO, *args: Any) -> "UpdateBotCallbackQuery": flags = Int.read(data) query_id = Long.read(data) user_id = Int.read(data) peer = TLObject.read(data) msg_id = Int.read(data) chat_instance = Long.read(data) data = Bytes.read(data) if flags & (1 << 0) else None game_short_name = String.read(data) if flags & (1 << 1) else None return UpdateBotCallbackQuery(query_id=query_id, user_id=user_id, peer=peer, msg_id=msg_id, chat_instance=chat_instance, data=data, game_short_name=game_short_name)
def write(self) -> bytes: data = BytesIO() data.write(Int(self.ID, False)) # No flags data.write(Long(self.id)) data.write(Int(self.parts)) data.write(Int(self.key_fingerprint)) return data.getvalue()
def write(self) -> bytes: data = BytesIO() data.write(Int(self.ID, False)) # No flags data.write(self.text.write()) data.write(String(self.url)) data.write(Long(self.webpage_id)) return data.getvalue()
def write(self) -> bytes: data = BytesIO() data.write(Int(self.ID, False)) # No flags data.write(Double(self.long)) data.write(Double(self.lat)) data.write(Long(self.access_hash)) return data.getvalue()
def write(self) -> bytes: data = BytesIO() data.write(Int(self.ID, False)) # No flags data.write(self.secure_algo.write()) data.write(Bytes(self.secure_secret)) data.write(Long(self.secure_secret_id)) return data.getvalue()
def write(self) -> bytes: data = BytesIO() data.write(Int(self.ID, False)) # No flags data.write(Long(self.bad_msg_id)) data.write(Int(self.bad_msg_seqno)) data.write(Int(self.error_code)) return data.getvalue()
def write(self) -> bytes: data = BytesIO() data.write(Int(self.ID, False)) # No flags data.write(Long(self.srp_id)) data.write(Bytes(self.A)) data.write(Bytes(self.M1)) return data.getvalue()
def write(self) -> bytes: data = BytesIO() data.write(Int(self.ID, False)) # No flags data.write(Long(self.file_id)) data.write(Int(self.file_part)) data.write(Bytes(self.bytes)) return data.getvalue()
def write(self) -> bytes: data = BytesIO() data.write(Int(self.ID, False)) flags = 0 flags |= (1 << 0) if self.masks is not None else 0 data.write(Int(flags)) data.write(Long(self.offset_id)) data.write(Int(self.limit)) return data.getvalue()
def write(self) -> bytes: data = BytesIO() data.write(Int(self.ID, False)) data.write(Long(self.id)) flags = 0 flags |= (1 << 0) if self.creator else 0 flags |= (1 << 1) if self.default else 0 flags |= (1 << 3) if self.pattern else 0 flags |= (1 << 4) if self.dark else 0 flags |= (1 << 2) if self.settings is not None else 0 data.write(Int(flags)) data.write(Long(self.access_hash)) data.write(String(self.slug)) data.write(self.document.write()) if self.settings is not None: data.write(self.settings.write()) return data.getvalue()
def read(data: BytesIO, *args: Any) -> "ChannelForbidden": flags = Int.read(data) broadcast = True if flags & (1 << 5) else False megagroup = True if flags & (1 << 8) else False id = Int.read(data) access_hash = Long.read(data) title = String.read(data) until_date = Int.read(data) if flags & (1 << 16) else None return ChannelForbidden(id=id, access_hash=access_hash, title=title, broadcast=broadcast, megagroup=megagroup, until_date=until_date)
def read(data: BytesIO, *args: Any) -> "EncryptedMessage": # No flags random_id = Long.read(data) chat_id = Int.read(data) date = Int.read(data) bytes = Bytes.read(data) file = TLObject.read(data) return EncryptedMessage(random_id=random_id, chat_id=chat_id, date=date, bytes=bytes, file=file)
def read(data: BytesIO, *args: Any) -> "SendEncrypted": flags = Int.read(data) silent = True if flags & (1 << 0) else False peer = TLObject.read(data) random_id = Long.read(data) data = Bytes.read(data) return SendEncrypted(peer=peer, random_id=random_id, data=data, silent=silent)
def write(self) -> bytes: data = BytesIO() data.write(Int(self.ID, False)) flags = 0 flags |= (1 << 0) if self.autoplay is not None else 0 flags |= (1 << 1) if self.loop is not None else 0 data.write(Int(flags)) data.write(Long(self.video_id)) data.write(self.caption.write()) return data.getvalue()
def read(data: BytesIO, *args: Any) -> "GeoPoint": flags = Int.read(data) long = Double.read(data) lat = Double.read(data) access_hash = Long.read(data) accuracy_radius = Int.read(data) if flags & (1 << 0) else None return GeoPoint(long=long, lat=lat, access_hash=access_hash, accuracy_radius=accuracy_radius)
def read(data: BytesIO, *args: Any) -> "PhoneConnection": # No flags id = Long.read(data) ip = String.read(data) ipv6 = String.read(data) port = Int.read(data) peer_tag = Bytes.read(data) return PhoneConnection(id=id, ip=ip, ipv6=ipv6, port=port, peer_tag=peer_tag)
def read(data: BytesIO, *args: Any) -> "InputSecureFileUploaded": # No flags id = Long.read(data) parts = Int.read(data) md5_checksum = String.read(data) file_hash = Bytes.read(data) secret = Bytes.read(data) return InputSecureFileUploaded(id=id, parts=parts, md5_checksum=md5_checksum, file_hash=file_hash, secret=secret)
def write(self) -> bytes: data = BytesIO() data.write(Int(self.ID, False)) flags = 0 flags |= (1 << 6) if self.video else 0 data.write(Int(flags)) data.write(Long(self.id)) data.write(Long(self.access_hash)) data.write(Int(self.date)) data.write(Int(self.admin_id)) data.write(Int(self.participant_id)) data.write(Bytes(self.g_b)) data.write(self.protocol.write()) return data.getvalue()
def read(data: BytesIO, *args: Any) -> "InputPeerPhotoFileLocation": flags = Int.read(data) big = True if flags & (1 << 0) else False peer = TLObject.read(data) volume_id = Long.read(data) local_id = Int.read(data) return InputPeerPhotoFileLocation(peer=peer, volume_id=volume_id, local_id=local_id, big=big)
def read(data: BytesIO, *args: Any) -> "UpdateBotPrecheckoutQuery": flags = Int.read(data) query_id = Long.read(data) user_id = Int.read(data) payload = Bytes.read(data) info = TLObject.read(data) if flags & (1 << 0) else None shipping_option_id = String.read(data) if flags & (1 << 1) else None currency = String.read(data) total_amount = Long.read(data) return UpdateBotPrecheckoutQuery(query_id=query_id, user_id=user_id, payload=payload, currency=currency, total_amount=total_amount, info=info, shipping_option_id=shipping_option_id)
def write(self) -> bytes: data = BytesIO() data.write(Int(self.ID, False)) flags = 0 flags |= (1 << 0) if self.x is not None else 0 data.write(Int(flags)) data.write(String(self.token)) if self.x is not None: data.write(Long(self.x)) return data.getvalue()