Ejemplo n.º 1
0
 def read(data: BytesIO, *args: Any) -> "EditAdmin":
     # No flags
     
     channel = TLObject.read(data)
     
     user_id = TLObject.read(data)
     
     admin_rights = TLObject.read(data)
     
     rank = String.read(data)
     
     return EditAdmin(channel=channel, user_id=user_id, admin_rights=admin_rights, rank=rank)
Ejemplo n.º 2
0
    def read(data: BytesIO, *args: Any) -> "NearestDc":
        # No flags

        country = String.read(data)

        this_dc = Int.read(data)

        nearest_dc = Int.read(data)

        return NearestDc(country=country,
                         this_dc=this_dc,
                         nearest_dc=nearest_dc)
Ejemplo n.º 3
0
 def read(data: BytesIO, *args: Any) -> "GetPollVotes":
     flags = Int.read(data)
     
     peer = TLObject.read(data)
     
     id = Int.read(data)
     
     option = Bytes.read(data) if flags & (1 << 0) else None
     offset = String.read(data) if flags & (1 << 1) else None
     limit = Int.read(data)
     
     return GetPollVotes(peer=peer, id=id, limit=limit, option=option, offset=offset)
    def read(data: BytesIO, *args: Any) -> "UnregisterDevice":
        # No flags

        token_type = Int.read(data)

        token = String.read(data)

        other_uids = TLObject.read(data, Int)

        return UnregisterDevice(token_type=token_type,
                                token=token,
                                other_uids=other_uids)
Ejemplo n.º 5
0
    def read(data: BytesIO, *args: Any) -> "PromoData":
        flags = Int.read(data)

        proxy = True if flags & (1 << 0) else False
        expires = Int.read(data)

        peer = TLObject.read(data)

        chats = TLObject.read(data)

        users = TLObject.read(data)

        psa_type = String.read(data) if flags & (1 << 1) else None
        psa_message = String.read(data) if flags & (1 << 2) else None
        return PromoData(expires=expires,
                         peer=peer,
                         chats=chats,
                         users=users,
                         proxy=proxy,
                         psa_type=psa_type,
                         psa_message=psa_message)
Ejemplo n.º 6
0
    def read(data: BytesIO, *args: Any) -> "InputAppEvent":
        # No flags

        time = Double.read(data)

        type = String.read(data)

        peer = Long.read(data)

        data = TLObject.read(data)

        return InputAppEvent(time=time, type=type, peer=peer, data=data)
    def read(data: BytesIO, *args: Any) -> "MessageActionPaymentSentMe":
        flags = Int.read(data)

        currency = String.read(data)

        total_amount = Long.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
        charge = TLObject.read(data)

        return MessageActionPaymentSentMe(
            currency=currency,
            total_amount=total_amount,
            payload=payload,
            charge=charge,
            info=info,
            shipping_option_id=shipping_option_id)
Ejemplo n.º 8
0
    def read(data: BytesIO, *args: Any) -> "MessageEntityPre":
        # No flags

        offset = Int.read(data)

        length = Int.read(data)

        language = String.read(data)

        return MessageEntityPre(offset=offset,
                                length=length,
                                language=language)
Ejemplo n.º 9
0
    def read(data: BytesIO, *args: Any) -> "UploadWallPaper":
        # No flags

        file = TLObject.read(data)

        mime_type = String.read(data)

        settings = TLObject.read(data)

        return UploadWallPaper(file=file,
                               mime_type=mime_type,
                               settings=settings)
Ejemplo n.º 10
0
    def read(data: BytesIO, *args: Any) -> "EditLocation":
        # No flags

        channel = TLObject.read(data)

        geo_point = TLObject.read(data)

        address = String.read(data)

        return EditLocation(channel=channel,
                            geo_point=geo_point,
                            address=address)
Ejemplo n.º 11
0
    def read(data: BytesIO, *args: Any) -> "ExportLoginToken":
        # No flags

        api_id = Int.read(data)

        api_hash = String.read(data)

        except_ids = TLObject.read(data, Int)

        return ExportLoginToken(api_id=api_id,
                                api_hash=api_hash,
                                except_ids=except_ids)
Ejemplo n.º 12
0
    def read(data: BytesIO, *args: Any) -> "RequestUrlAuth":
        flags = Int.read(data)

        peer = TLObject.read(data) if flags & (1 << 1) else None

        msg_id = Int.read(data) if flags & (1 << 1) else None
        button_id = Int.read(data) if flags & (1 << 1) else None
        url = String.read(data) if flags & (1 << 2) else None
        return RequestUrlAuth(peer=peer,
                              msg_id=msg_id,
                              button_id=button_id,
                              url=url)
    def read(data: BytesIO, *args: Any) -> "InputMediaPoll":
        flags = Int.read(data)

        poll = TLObject.read(data)

        correct_answers = TLObject.read(data, Bytes) if flags & (1 << 0) else []

        solution = String.read(data) if flags & (1 << 1) else None
        solution_entities = TLObject.read(data) if flags & (1 << 1) else []

        return InputMediaPoll(poll=poll, correct_answers=correct_answers, solution=solution,
                              solution_entities=solution_entities)
Ejemplo n.º 14
0
    def read(data: BytesIO, *args: Any) -> "AccessPointRule":
        # No flags

        phone_prefix_rules = String.read(data)

        dc_id = Int.read(data)

        ips = TLObject.read(data)

        return AccessPointRule(phone_prefix_rules=phone_prefix_rules,
                               dc_id=dc_id,
                               ips=ips)
Ejemplo n.º 15
0
    def read(data: BytesIO, *args: Any) -> "BotInlineMessageText":
        flags = Int.read(data)

        no_webpage = True if flags & (1 << 0) else False
        message = String.read(data)

        entities = TLObject.read(data) if flags & (1 << 1) else []

        reply_markup = TLObject.read(data) if flags & (1 << 2) else None

        return BotInlineMessageText(message=message, no_webpage=no_webpage, entities=entities,
                                    reply_markup=reply_markup)
Ejemplo n.º 16
0
    def read(data: BytesIO, *args: Any) -> "SecureValueErrorReverseSide":
        # No flags

        type = TLObject.read(data)

        file_hash = Bytes.read(data)

        text = String.read(data)

        return SecureValueErrorReverseSide(type=type,
                                           file_hash=file_hash,
                                           text=text)
 def read(data: BytesIO, *args: Any) -> "InputPhotoFileLocation":
     # No flags
     
     id = Long.read(data)
     
     access_hash = Long.read(data)
     
     file_reference = Bytes.read(data)
     
     thumb_size = String.read(data)
     
     return InputPhotoFileLocation(id=id, access_hash=access_hash, file_reference=file_reference, thumb_size=thumb_size)
Ejemplo n.º 18
0
    def read(data: BytesIO, *args: Any) -> "BotInfo":
        # No flags

        user_id = Int.read(data)

        description = String.read(data)

        commands = TLObject.read(data)

        return BotInfo(user_id=user_id,
                       description=description,
                       commands=commands)
    def read(data: BytesIO, *args: Any) -> "BotInlineMessageMediaAuto":
        flags = Int.read(data)

        message = String.read(data)

        entities = TLObject.read(data) if flags & (1 << 1) else []

        reply_markup = TLObject.read(data) if flags & (1 << 2) else None

        return BotInlineMessageMediaAuto(message=message,
                                         entities=entities,
                                         reply_markup=reply_markup)
Ejemplo n.º 20
0
    def read(data: BytesIO, *args: Any) -> "InputStickerSetItem":
        flags = Int.read(data)

        document = TLObject.read(data)

        emoji = String.read(data)

        mask_coords = TLObject.read(data) if flags & (1 << 0) else None

        return InputStickerSetItem(document=document,
                                   emoji=emoji,
                                   mask_coords=mask_coords)
Ejemplo n.º 21
0
    def read(data: BytesIO, *args: Any) -> "EditUserInfo":
        # No flags

        user_id = TLObject.read(data)

        message = String.read(data)

        entities = TLObject.read(data)

        return EditUserInfo(user_id=user_id,
                            message=message,
                            entities=entities)
Ejemplo n.º 22
0
 def read(data: BytesIO, *args: Any) -> "TermsOfService":
     flags = Int.read(data)
     
     popup = True if flags & (1 << 0) else False
     id = TLObject.read(data)
     
     text = String.read(data)
     
     entities = TLObject.read(data)
     
     min_age_confirm = Int.read(data) if flags & (1 << 1) else None
     return TermsOfService(id=id, text=text, entities=entities, popup=popup, min_age_confirm=min_age_confirm)
 def read(data: BytesIO, *args: Any) -> "LangPackDifference":
     # No flags
     
     lang_code = String.read(data)
     
     from_version = Int.read(data)
     
     version = Int.read(data)
     
     strings = TLObject.read(data)
     
     return LangPackDifference(lang_code=lang_code, from_version=from_version, version=version, strings=strings)
Ejemplo n.º 24
0
    def read(data: BytesIO, *args: Any) -> "InputMediaVenue":
        # No flags

        geo_point = TLObject.read(data)

        title = String.read(data)

        address = String.read(data)

        provider = String.read(data)

        venue_id = String.read(data)

        venue_type = String.read(data)

        return InputMediaVenue(geo_point=geo_point,
                               title=title,
                               address=address,
                               provider=provider,
                               venue_id=venue_id,
                               venue_type=venue_type)
    def read(data: BytesIO, *args: Any) -> "UpdateBotInlineQuery":
        flags = Int.read(data)

        query_id = Long.read(data)

        user_id = Int.read(data)

        query = String.read(data)

        geo = TLObject.read(data) if flags & (1 << 0) else None

        peer_type = TLObject.read(data) if flags & (1 << 1) else None

        offset = String.read(data)

        return UpdateBotInlineQuery(query_id=query_id,
                                    user_id=user_id,
                                    query=query,
                                    offset=offset,
                                    geo=geo,
                                    peer_type=peer_type)
Ejemplo n.º 26
0
 def read(data: BytesIO, *args: Any) -> "InputEncryptedFileUploaded":
     # No flags
     
     id = Long.read(data)
     
     parts = Int.read(data)
     
     md5_checksum = String.read(data)
     
     key_fingerprint = Int.read(data)
     
     return InputEncryptedFileUploaded(id=id, parts=parts, md5_checksum=md5_checksum, key_fingerprint=key_fingerprint)
Ejemplo n.º 27
0
    def read(data: BytesIO, *args: Any) -> "InitConnection":
        flags = Int.read(data)

        api_id = Int.read(data)

        device_model = String.read(data)

        system_version = String.read(data)

        app_version = String.read(data)

        system_lang_code = String.read(data)

        lang_pack = String.read(data)

        lang_code = String.read(data)

        proxy = TLObject.read(data) if flags & (1 << 0) else None

        params = TLObject.read(data) if flags & (1 << 1) else None

        query = TLObject.read(data)

        return InitConnection(api_id=api_id,
                              device_model=device_model,
                              system_version=system_version,
                              app_version=app_version,
                              system_lang_code=system_lang_code,
                              lang_pack=lang_pack,
                              lang_code=lang_code,
                              query=query,
                              proxy=proxy,
                              params=params)
Ejemplo n.º 28
0
    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
        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,
                    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)
Ejemplo n.º 29
0
    def read(data: BytesIO, *args: Any) -> "LangPackLanguage":
        flags = Int.read(data)

        official = True if flags & (1 << 0) else False
        rtl = True if flags & (1 << 2) else False
        beta = True if flags & (1 << 3) else False
        name = String.read(data)

        native_name = String.read(data)

        lang_code = String.read(data)

        base_lang_code = String.read(data) if flags & (1 << 1) else None
        plural_code = String.read(data)

        strings_count = Int.read(data)

        translated_count = Int.read(data)

        translations_url = String.read(data)

        return LangPackLanguage(name=name,
                                native_name=native_name,
                                lang_code=lang_code,
                                plural_code=plural_code,
                                strings_count=strings_count,
                                translated_count=translated_count,
                                translations_url=translations_url,
                                official=official,
                                rtl=rtl,
                                beta=beta,
                                base_lang_code=base_lang_code)
Ejemplo n.º 30
0
 def read(data: BytesIO, *args: Any) -> "WebAuthorization":
     # No flags
     
     hash = Long.read(data)
     
     bot_id = Int.read(data)
     
     domain = String.read(data)
     
     browser = String.read(data)
     
     platform = String.read(data)
     
     date_created = Int.read(data)
     
     date_active = Int.read(data)
     
     ip = String.read(data)
     
     region = String.read(data)
     
     return WebAuthorization(hash=hash, bot_id=bot_id, domain=domain, browser=browser, platform=platform, date_created=date_created, date_active=date_active, ip=ip, region=region)