def read(data: BytesIO, *args: Any) -> "EncryptedChatRequested": flags = Int.read(data) folder_id = Int.read(data) if flags & (1 << 0) else None id = Int.read(data) access_hash = Long.read(data) date = Int.read(data) admin_id = Int.read(data) participant_id = Int.read(data) g_a = Bytes.read(data) return EncryptedChatRequested(id=id, access_hash=access_hash, date=date, admin_id=admin_id, participant_id=participant_id, g_a=g_a, folder_id=folder_id)
def read(data: BytesIO, *args: Any) -> "Message": flags = Int.read(data) out = True if flags & (1 << 1) else False mentioned = True if flags & (1 << 4) else False media_unread = True if flags & (1 << 5) else False silent = True if flags & (1 << 13) else False post = True if flags & (1 << 14) else False from_scheduled = True if flags & (1 << 18) else False legacy = True if flags & (1 << 19) else False edit_hide = True if flags & (1 << 21) else False id = Int.read(data) from_id = Int.read(data) if flags & (1 << 8) else None to_id = TLObject.read(data) fwd_from = TLObject.read(data) if flags & (1 << 2) else None via_bot_id = Int.read(data) if flags & (1 << 11) else None reply_to_msg_id = Int.read(data) if flags & (1 << 3) else None date = Int.read(data) message = String.read(data) media = TLObject.read(data) if flags & (1 << 9) else None reply_markup = TLObject.read(data) if flags & (1 << 6) else None entities = TLObject.read(data) if flags & (1 << 7) else [] views = Int.read(data) if flags & (1 << 10) else None edit_date = Int.read(data) if flags & (1 << 15) else None post_author = String.read(data) if flags & (1 << 16) else None grouped_id = Long.read(data) if flags & (1 << 17) else None restriction_reason = TLObject.read(data) if flags & (1 << 22) else [] return Message(id=id, to_id=to_id, date=date, message=message, out=out, mentioned=mentioned, media_unread=media_unread, silent=silent, post=post, from_scheduled=from_scheduled, legacy=legacy, edit_hide=edit_hide, from_id=from_id, fwd_from=fwd_from, via_bot_id=via_bot_id, reply_to_msg_id=reply_to_msg_id, media=media, reply_markup=reply_markup, entities=entities, views=views, edit_date=edit_date, post_author=post_author, grouped_id=grouped_id, restriction_reason=restriction_reason)
def read(data: BytesIO, *args: Any) -> "Poll": id = Long.read(data) flags = Int.read(data) closed = True if flags & (1 << 0) else False public_voters = True if flags & (1 << 1) else False multiple_choice = True if flags & (1 << 2) else False quiz = True if flags & (1 << 3) else False question = String.read(data) answers = TLObject.read(data) close_period = Int.read(data) if flags & (1 << 4) else None close_date = Int.read(data) if flags & (1 << 5) else None return Poll(id=id, question=question, answers=answers, closed=closed, public_voters=public_voters, multiple_choice=multiple_choice, quiz=quiz, close_period=close_period, close_date=close_date)
def read(data: BytesIO, *args: Any) -> "PaymentReceipt": flags = Int.read(data) date = Int.read(data) bot_id = Int.read(data) invoice = TLObject.read(data) provider_id = Int.read(data) info = TLObject.read(data) if flags & (1 << 0) else None shipping = TLObject.read(data) if flags & (1 << 1) else None currency = String.read(data) total_amount = Long.read(data) credentials_title = String.read(data) users = TLObject.read(data) return PaymentReceipt(date=date, bot_id=bot_id, invoice=invoice, provider_id=provider_id, currency=currency, total_amount=total_amount, credentials_title=credentials_title, users=users, info=info, shipping=shipping)
def read(data: BytesIO, *args: Any) -> "WebPageEmpty": # No flags id = Long.read(data) return WebPageEmpty(id=id)
def read(data: BytesIO, *args: Any) -> "Channel": flags = Int.read(data) creator = True if flags & (1 << 0) else False left = True if flags & (1 << 2) else False broadcast = True if flags & (1 << 5) else False verified = True if flags & (1 << 7) else False megagroup = True if flags & (1 << 8) else False restricted = True if flags & (1 << 9) else False signatures = True if flags & (1 << 11) else False min = True if flags & (1 << 12) else False scam = True if flags & (1 << 19) else False has_link = True if flags & (1 << 20) else False has_geo = True if flags & (1 << 21) else False slowmode_enabled = True if flags & (1 << 22) else False call_active = True if flags & (1 << 23) else False call_not_empty = True if flags & (1 << 24) else False fake = True if flags & (1 << 25) else False id = Int.read(data) access_hash = Long.read(data) if flags & (1 << 13) else None title = String.read(data) username = String.read(data) if flags & (1 << 6) else None photo = TLObject.read(data) date = Int.read(data) version = Int.read(data) restriction_reason = TLObject.read(data) if flags & (1 << 9) else [] admin_rights = TLObject.read(data) if flags & (1 << 14) else None banned_rights = TLObject.read(data) if flags & (1 << 15) else None default_banned_rights = TLObject.read( data) if flags & (1 << 18) else None participants_count = Int.read(data) if flags & (1 << 17) else None return Channel(id=id, title=title, photo=photo, date=date, version=version, creator=creator, left=left, broadcast=broadcast, verified=verified, megagroup=megagroup, restricted=restricted, signatures=signatures, min=min, scam=scam, has_link=has_link, has_geo=has_geo, slowmode_enabled=slowmode_enabled, call_active=call_active, call_not_empty=call_not_empty, fake=fake, access_hash=access_hash, username=username, restriction_reason=restriction_reason, admin_rights=admin_rights, banned_rights=banned_rights, default_banned_rights=default_banned_rights, participants_count=participants_count)
def read(data: BytesIO, *args: Any) -> "DestroySession": # No flags session_id = Long.read(data) return DestroySession(session_id=session_id)
def read(data: BytesIO, *args: Any) -> "PhoneCallEmpty": # No flags id = Long.read(data) return PhoneCallEmpty(id=id)
def read(data: BytesIO, *args: Any) -> "ResetWebAuthorization": # No flags hash = Long.read(data) return ResetWebAuthorization(hash=hash)
def read(data: BytesIO, *args: Any) -> "RpcDropAnswer": # No flags req_msg_id = Long.read(data) return RpcDropAnswer(req_msg_id=req_msg_id)
def read(data: BytesIO, *args: Any) -> "DocumentEmpty": # No flags id = Long.read(data) return DocumentEmpty(id=id)
def read(data: BytesIO, *args: Any) -> "Takeout": # No flags id = Long.read(data) return Takeout(id=id)
def read(data: BytesIO, *args: Any) -> "Ping": # No flags ping_id = Long.read(data) return Ping(ping_id=ping_id)
def read(data: BytesIO, *args: Any) -> "HistoryImport": # No flags id = Long.read(data) return HistoryImport(id=id)
def read(data: BytesIO, *args: Any) -> "User": flags = Int.read(data) is_self = True if flags & (1 << 10) else False contact = True if flags & (1 << 11) else False mutual_contact = True if flags & (1 << 12) else False deleted = True if flags & (1 << 13) else False bot = True if flags & (1 << 14) else False bot_chat_history = True if flags & (1 << 15) else False bot_nochats = True if flags & (1 << 16) else False verified = True if flags & (1 << 17) else False restricted = True if flags & (1 << 18) else False min = True if flags & (1 << 20) else False bot_inline_geo = True if flags & (1 << 21) else False support = True if flags & (1 << 23) else False scam = True if flags & (1 << 24) else False apply_min_photo = True if flags & (1 << 25) else False fake = True if flags & (1 << 26) else False id = Int.read(data) access_hash = Long.read(data) if flags & (1 << 0) else None first_name = String.read(data) if flags & (1 << 1) else None last_name = String.read(data) if flags & (1 << 2) else None username = String.read(data) if flags & (1 << 3) else None phone = String.read(data) if flags & (1 << 4) else None photo = TLObject.read(data) if flags & (1 << 5) else None status = TLObject.read(data) if flags & (1 << 6) else None bot_info_version = Int.read(data) if flags & (1 << 14) else None restriction_reason = TLObject.read(data) if flags & (1 << 18) else [] bot_inline_placeholder = String.read( data) if flags & (1 << 19) else None lang_code = String.read(data) if flags & (1 << 22) else None return User(id=id, is_self=is_self, contact=contact, mutual_contact=mutual_contact, deleted=deleted, bot=bot, bot_chat_history=bot_chat_history, bot_nochats=bot_nochats, verified=verified, restricted=restricted, min=min, bot_inline_geo=bot_inline_geo, support=support, scam=scam, apply_min_photo=apply_min_photo, fake=fake, access_hash=access_hash, first_name=first_name, last_name=last_name, username=username, phone=phone, photo=photo, status=status, bot_info_version=bot_info_version, restriction_reason=restriction_reason, bot_inline_placeholder=bot_inline_placeholder, lang_code=lang_code)