"""File auto-generated by tglib TL generator. Do not edit manually."""
from ..tlobject import TLObject
from typing import Optional, List, Union
import os
import struct
from datetime import datetime


class AffectedFoundMessages(TLObject):
    """TL type: messages.affectedFoundMessages"""
    CONSTRUCTOR_ID = 0xef8d3e6c
    SUBCLASS_OF_ID = 0xf817652e

    def __init__(self, pts: int, pts_count: int, offset: int, messages: List[int]):
        self.pts = pts
        self.pts_count = pts_count
        self.offset = offset
        self.messages = messages

    def to_dict(self):
        return {
            '_': 'AffectedFoundMessages',
            'pts': self.pts,
            'pts_count': self.pts_count,
            'offset': self.offset,
            'messages': self.messages,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', self.pts))
        buf.write(struct.pack('<i', self.pts_count))
        buf.write(struct.pack('<i', self.offset))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.messages)))
        for item in self.messages:
            buf.write(struct.pack('<i', self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_pts = reader.read_int()
        _args['pts'] = _val_pts
        _val_pts_count = reader.read_int()
        _args['pts_count'] = _val_pts_count
        _val_offset = reader.read_int()
        _args['offset'] = _val_offset
        reader.read_int(signed=False)  # skip vector id
        _count_messages = reader.read_int()
        _list_messages = []
        for _ in range(_count_messages):
            _item_messages = reader.read_int()
            _list_messages.append(_item_messages)
        _args['messages'] = _list_messages
        return cls(**_args)


class AffectedHistory(TLObject):
    """TL type: messages.affectedHistory"""
    CONSTRUCTOR_ID = 0xb45c69d1
    SUBCLASS_OF_ID = 0x2c49c116

    def __init__(self, pts: int, pts_count: int, offset: int):
        self.pts = pts
        self.pts_count = pts_count
        self.offset = offset

    def to_dict(self):
        return {
            '_': 'AffectedHistory',
            'pts': self.pts,
            'pts_count': self.pts_count,
            'offset': self.offset,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', self.pts))
        buf.write(struct.pack('<i', self.pts_count))
        buf.write(struct.pack('<i', self.offset))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_pts = reader.read_int()
        _args['pts'] = _val_pts
        _val_pts_count = reader.read_int()
        _args['pts_count'] = _val_pts_count
        _val_offset = reader.read_int()
        _args['offset'] = _val_offset
        return cls(**_args)


class AffectedMessages(TLObject):
    """TL type: messages.affectedMessages"""
    CONSTRUCTOR_ID = 0x84d19185
    SUBCLASS_OF_ID = 0xced3c06e

    def __init__(self, pts: int, pts_count: int):
        self.pts = pts
        self.pts_count = pts_count

    def to_dict(self):
        return {
            '_': 'AffectedMessages',
            'pts': self.pts,
            'pts_count': self.pts_count,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', self.pts))
        buf.write(struct.pack('<i', self.pts_count))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_pts = reader.read_int()
        _args['pts'] = _val_pts
        _val_pts_count = reader.read_int()
        _args['pts_count'] = _val_pts_count
        return cls(**_args)


class AllStickers(TLObject):
    """TL type: messages.allStickers"""
    CONSTRUCTOR_ID = 0xcdbbcebb
    SUBCLASS_OF_ID = 0x45834829

    def __init__(self, hash: int, sets: List['TypeStickerSet']):
        self.hash = hash
        self.sets = sets

    def to_dict(self):
        return {
            '_': 'AllStickers',
            'hash': self.hash,
            'sets': self.sets,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<q', self.hash))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.sets)))
        for item in self.sets:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_hash = reader.read_long()
        _args['hash'] = _val_hash
        reader.read_int(signed=False)  # skip vector id
        _count_sets = reader.read_int()
        _list_sets = []
        for _ in range(_count_sets):
            _item_sets = reader.tgread_object()
            _list_sets.append(_item_sets)
        _args['sets'] = _list_sets
        return cls(**_args)


class AllStickersNotModified(TLObject):
    """TL type: messages.allStickersNotModified"""
    CONSTRUCTOR_ID = 0xe86602c3
    SUBCLASS_OF_ID = 0x45834829

    def __init__(self):
        pass

    def to_dict(self):
        return {
            '_': 'AllStickersNotModified',
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        return cls()


class ArchivedStickers(TLObject):
    """TL type: messages.archivedStickers"""
    CONSTRUCTOR_ID = 0x4fcba9c8
    SUBCLASS_OF_ID = 0x7296d771

    def __init__(self, count: int, sets: List['TypeStickerSetCovered']):
        self.count = count
        self.sets = sets

    def to_dict(self):
        return {
            '_': 'ArchivedStickers',
            'count': self.count,
            'sets': self.sets,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', self.count))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.sets)))
        for item in self.sets:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_count = reader.read_int()
        _args['count'] = _val_count
        reader.read_int(signed=False)  # skip vector id
        _count_sets = reader.read_int()
        _list_sets = []
        for _ in range(_count_sets):
            _item_sets = reader.tgread_object()
            _list_sets.append(_item_sets)
        _args['sets'] = _list_sets
        return cls(**_args)


class AvailableEffects(TLObject):
    """TL type: messages.availableEffects"""
    CONSTRUCTOR_ID = 0xbddb616e
    SUBCLASS_OF_ID = 0x4470d5bd

    def __init__(self, hash: int, effects: List['TypeAvailableEffect'], documents: List['TypeDocument']):
        self.hash = hash
        self.effects = effects
        self.documents = documents

    def to_dict(self):
        return {
            '_': 'AvailableEffects',
            'hash': self.hash,
            'effects': self.effects,
            'documents': self.documents,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', self.hash))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.effects)))
        for item in self.effects:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.documents)))
        for item in self.documents:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_hash = reader.read_int()
        _args['hash'] = _val_hash
        reader.read_int(signed=False)  # skip vector id
        _count_effects = reader.read_int()
        _list_effects = []
        for _ in range(_count_effects):
            _item_effects = reader.tgread_object()
            _list_effects.append(_item_effects)
        _args['effects'] = _list_effects
        reader.read_int(signed=False)  # skip vector id
        _count_documents = reader.read_int()
        _list_documents = []
        for _ in range(_count_documents):
            _item_documents = reader.tgread_object()
            _list_documents.append(_item_documents)
        _args['documents'] = _list_documents
        return cls(**_args)


class AvailableEffectsNotModified(TLObject):
    """TL type: messages.availableEffectsNotModified"""
    CONSTRUCTOR_ID = 0xd1ed9a5b
    SUBCLASS_OF_ID = 0x4470d5bd

    def __init__(self):
        pass

    def to_dict(self):
        return {
            '_': 'AvailableEffectsNotModified',
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        return cls()


class AvailableReactions(TLObject):
    """TL type: messages.availableReactions"""
    CONSTRUCTOR_ID = 0x768e3aad
    SUBCLASS_OF_ID = 0xe426ad82

    def __init__(self, hash: int, reactions: List['TypeAvailableReaction']):
        self.hash = hash
        self.reactions = reactions

    def to_dict(self):
        return {
            '_': 'AvailableReactions',
            'hash': self.hash,
            'reactions': self.reactions,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', self.hash))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.reactions)))
        for item in self.reactions:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_hash = reader.read_int()
        _args['hash'] = _val_hash
        reader.read_int(signed=False)  # skip vector id
        _count_reactions = reader.read_int()
        _list_reactions = []
        for _ in range(_count_reactions):
            _item_reactions = reader.tgread_object()
            _list_reactions.append(_item_reactions)
        _args['reactions'] = _list_reactions
        return cls(**_args)


class AvailableReactionsNotModified(TLObject):
    """TL type: messages.availableReactionsNotModified"""
    CONSTRUCTOR_ID = 0x9f071957
    SUBCLASS_OF_ID = 0xe426ad82

    def __init__(self):
        pass

    def to_dict(self):
        return {
            '_': 'AvailableReactionsNotModified',
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        return cls()


class BotApp(TLObject):
    """TL type: messages.botApp"""
    CONSTRUCTOR_ID = 0xeb50adf5
    SUBCLASS_OF_ID = 0x8f7243a7

    def __init__(self, app: 'TypeBotApp', inactive: Optional[bool] = None, request_write_access: Optional[bool] = None, has_settings: Optional[bool] = None):
        self.app = app
        self.inactive = inactive
        self.request_write_access = request_write_access
        self.has_settings = has_settings

    def to_dict(self):
        return {
            '_': 'BotApp',
            'app': self.app,
            'inactive': self.inactive,
            'request_write_access': self.request_write_access,
            'has_settings': self.has_settings,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        flags = 0
        if self.inactive:
            flags |= (1 << 0)
        if self.request_write_access:
            flags |= (1 << 1)
        if self.has_settings:
            flags |= (1 << 2)
        buf.write(struct.pack('<I', flags))
        buf.write(bytes(self.app))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        flags = reader.read_int(signed=False)
        _args['inactive'] = bool(flags & (1 << 0))
        _args['request_write_access'] = bool(flags & (1 << 1))
        _args['has_settings'] = bool(flags & (1 << 2))
        _val_app = reader.tgread_object()
        _args['app'] = _val_app
        return cls(**_args)


class BotCallbackAnswer(TLObject):
    """TL type: messages.botCallbackAnswer"""
    CONSTRUCTOR_ID = 0x36585ea4
    SUBCLASS_OF_ID = 0x6c4dd18c

    def __init__(self, cache_time: int, alert: Optional[bool] = None, has_url: Optional[bool] = None, native_ui: Optional[bool] = None, message: Optional[str] = None, url: Optional[str] = None):
        self.cache_time = cache_time
        self.alert = alert
        self.has_url = has_url
        self.native_ui = native_ui
        self.message = message
        self.url = url

    def to_dict(self):
        return {
            '_': 'BotCallbackAnswer',
            'cache_time': self.cache_time,
            'alert': self.alert,
            'has_url': self.has_url,
            'native_ui': self.native_ui,
            'message': self.message,
            'url': self.url,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        flags = 0
        if self.alert:
            flags |= (1 << 1)
        if self.has_url:
            flags |= (1 << 3)
        if self.native_ui:
            flags |= (1 << 4)
        if self.message is not None:
            flags |= (1 << 0)
        if self.url is not None:
            flags |= (1 << 2)
        buf.write(struct.pack('<I', flags))
        buf.write(struct.pack('<i', self.cache_time))
        if self.message is not None:
            buf.write(TLObject.serialize_bytes(self.message))
        if self.url is not None:
            buf.write(TLObject.serialize_bytes(self.url))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        flags = reader.read_int(signed=False)
        _args['alert'] = bool(flags & (1 << 1))
        _args['has_url'] = bool(flags & (1 << 3))
        _args['native_ui'] = bool(flags & (1 << 4))
        if flags & (1 << 0):
            _val_message = reader.tgread_string()
            _args['message'] = _val_message
        else:
            _args['message'] = None
        if flags & (1 << 2):
            _val_url = reader.tgread_string()
            _args['url'] = _val_url
        else:
            _args['url'] = None
        _val_cache_time = reader.read_int()
        _args['cache_time'] = _val_cache_time
        return cls(**_args)


class BotPreparedInlineMessage(TLObject):
    """TL type: messages.botPreparedInlineMessage"""
    CONSTRUCTOR_ID = 0x8ecf0511
    SUBCLASS_OF_ID = 0xef9119bb

    def __init__(self, id: str, expire_date: Optional[datetime]):
        self.id = id
        self.expire_date = expire_date

    def to_dict(self):
        return {
            '_': 'BotPreparedInlineMessage',
            'id': self.id,
            'expire_date': self.expire_date,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(TLObject.serialize_bytes(self.id))
        buf.write(struct.pack('<i', self.expire_date))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_id = reader.tgread_string()
        _args['id'] = _val_id
        _val_expire_date = reader.read_int()
        _args['expire_date'] = _val_expire_date
        return cls(**_args)


class BotResults(TLObject):
    """TL type: messages.botResults"""
    CONSTRUCTOR_ID = 0xe021f2f6
    SUBCLASS_OF_ID = 0x3ed4d9c9

    def __init__(self, query_id: int, results: List['TypeBotInlineResult'], cache_time: int, users: List['TypeUser'], gallery: Optional[bool] = None, next_offset: Optional[str] = None, switch_pm: Optional['TypeInlineBotSwitchPM'] = None, switch_webview: Optional['TypeInlineBotWebView'] = None):
        self.query_id = query_id
        self.results = results
        self.cache_time = cache_time
        self.users = users
        self.gallery = gallery
        self.next_offset = next_offset
        self.switch_pm = switch_pm
        self.switch_webview = switch_webview

    def to_dict(self):
        return {
            '_': 'BotResults',
            'query_id': self.query_id,
            'results': self.results,
            'cache_time': self.cache_time,
            'users': self.users,
            'gallery': self.gallery,
            'next_offset': self.next_offset,
            'switch_pm': self.switch_pm,
            'switch_webview': self.switch_webview,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        flags = 0
        if self.gallery:
            flags |= (1 << 0)
        if self.next_offset is not None:
            flags |= (1 << 1)
        if self.switch_pm is not None:
            flags |= (1 << 2)
        if self.switch_webview is not None:
            flags |= (1 << 3)
        buf.write(struct.pack('<I', flags))
        buf.write(struct.pack('<q', self.query_id))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.results)))
        for item in self.results:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', self.cache_time))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.users)))
        for item in self.users:
            buf.write(bytes(self.item))
        if self.next_offset is not None:
            buf.write(TLObject.serialize_bytes(self.next_offset))
        if self.switch_pm is not None:
            buf.write(bytes(self.switch_pm))
        if self.switch_webview is not None:
            buf.write(bytes(self.switch_webview))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        flags = reader.read_int(signed=False)
        _args['gallery'] = bool(flags & (1 << 0))
        _val_query_id = reader.read_long()
        _args['query_id'] = _val_query_id
        if flags & (1 << 1):
            _val_next_offset = reader.tgread_string()
            _args['next_offset'] = _val_next_offset
        else:
            _args['next_offset'] = None
        if flags & (1 << 2):
            _val_switch_pm = reader.tgread_object()
            _args['switch_pm'] = _val_switch_pm
        else:
            _args['switch_pm'] = None
        if flags & (1 << 3):
            _val_switch_webview = reader.tgread_object()
            _args['switch_webview'] = _val_switch_webview
        else:
            _args['switch_webview'] = None
        reader.read_int(signed=False)  # skip vector id
        _count_results = reader.read_int()
        _list_results = []
        for _ in range(_count_results):
            _item_results = reader.tgread_object()
            _list_results.append(_item_results)
        _args['results'] = _list_results
        _val_cache_time = reader.read_int()
        _args['cache_time'] = _val_cache_time
        reader.read_int(signed=False)  # skip vector id
        _count_users = reader.read_int()
        _list_users = []
        for _ in range(_count_users):
            _item_users = reader.tgread_object()
            _list_users.append(_item_users)
        _args['users'] = _list_users
        return cls(**_args)


class ChannelMessages(TLObject):
    """TL type: messages.channelMessages"""
    CONSTRUCTOR_ID = 0xc776ba4e
    SUBCLASS_OF_ID = 0xd4b40b5e

    def __init__(self, pts: int, count: int, messages: List['TypeMessage'], topics: List['TypeForumTopic'], chats: List['TypeChat'], users: List['TypeUser'], inexact: Optional[bool] = None, offset_id_offset: Optional[int] = None):
        self.pts = pts
        self.count = count
        self.messages = messages
        self.topics = topics
        self.chats = chats
        self.users = users
        self.inexact = inexact
        self.offset_id_offset = offset_id_offset

    def to_dict(self):
        return {
            '_': 'ChannelMessages',
            'pts': self.pts,
            'count': self.count,
            'messages': self.messages,
            'topics': self.topics,
            'chats': self.chats,
            'users': self.users,
            'inexact': self.inexact,
            'offset_id_offset': self.offset_id_offset,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        flags = 0
        if self.inexact:
            flags |= (1 << 1)
        if self.offset_id_offset is not None:
            flags |= (1 << 2)
        buf.write(struct.pack('<I', flags))
        buf.write(struct.pack('<i', self.pts))
        buf.write(struct.pack('<i', self.count))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.messages)))
        for item in self.messages:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.topics)))
        for item in self.topics:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.chats)))
        for item in self.chats:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.users)))
        for item in self.users:
            buf.write(bytes(self.item))
        if self.offset_id_offset is not None:
            buf.write(struct.pack('<i', self.offset_id_offset))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        flags = reader.read_int(signed=False)
        _args['inexact'] = bool(flags & (1 << 1))
        _val_pts = reader.read_int()
        _args['pts'] = _val_pts
        _val_count = reader.read_int()
        _args['count'] = _val_count
        if flags & (1 << 2):
            _val_offset_id_offset = reader.read_int()
            _args['offset_id_offset'] = _val_offset_id_offset
        else:
            _args['offset_id_offset'] = None
        reader.read_int(signed=False)  # skip vector id
        _count_messages = reader.read_int()
        _list_messages = []
        for _ in range(_count_messages):
            _item_messages = reader.tgread_object()
            _list_messages.append(_item_messages)
        _args['messages'] = _list_messages
        reader.read_int(signed=False)  # skip vector id
        _count_topics = reader.read_int()
        _list_topics = []
        for _ in range(_count_topics):
            _item_topics = reader.tgread_object()
            _list_topics.append(_item_topics)
        _args['topics'] = _list_topics
        reader.read_int(signed=False)  # skip vector id
        _count_chats = reader.read_int()
        _list_chats = []
        for _ in range(_count_chats):
            _item_chats = reader.tgread_object()
            _list_chats.append(_item_chats)
        _args['chats'] = _list_chats
        reader.read_int(signed=False)  # skip vector id
        _count_users = reader.read_int()
        _list_users = []
        for _ in range(_count_users):
            _item_users = reader.tgread_object()
            _list_users.append(_item_users)
        _args['users'] = _list_users
        return cls(**_args)


class ChatAdminsWithInvites(TLObject):
    """TL type: messages.chatAdminsWithInvites"""
    CONSTRUCTOR_ID = 0xb69b72d7
    SUBCLASS_OF_ID = 0x8f5bad2b

    def __init__(self, admins: List['TypeChatAdminWithInvites'], users: List['TypeUser']):
        self.admins = admins
        self.users = users

    def to_dict(self):
        return {
            '_': 'ChatAdminsWithInvites',
            'admins': self.admins,
            'users': self.users,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.admins)))
        for item in self.admins:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.users)))
        for item in self.users:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        reader.read_int(signed=False)  # skip vector id
        _count_admins = reader.read_int()
        _list_admins = []
        for _ in range(_count_admins):
            _item_admins = reader.tgread_object()
            _list_admins.append(_item_admins)
        _args['admins'] = _list_admins
        reader.read_int(signed=False)  # skip vector id
        _count_users = reader.read_int()
        _list_users = []
        for _ in range(_count_users):
            _item_users = reader.tgread_object()
            _list_users.append(_item_users)
        _args['users'] = _list_users
        return cls(**_args)


class ChatFull(TLObject):
    """TL type: messages.chatFull"""
    CONSTRUCTOR_ID = 0xe5d7d19c
    SUBCLASS_OF_ID = 0x225a5109

    def __init__(self, full_chat: 'TypeChatFull', chats: List['TypeChat'], users: List['TypeUser']):
        self.full_chat = full_chat
        self.chats = chats
        self.users = users

    def to_dict(self):
        return {
            '_': 'ChatFull',
            'full_chat': self.full_chat,
            'chats': self.chats,
            'users': self.users,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(bytes(self.full_chat))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.chats)))
        for item in self.chats:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.users)))
        for item in self.users:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_full_chat = reader.tgread_object()
        _args['full_chat'] = _val_full_chat
        reader.read_int(signed=False)  # skip vector id
        _count_chats = reader.read_int()
        _list_chats = []
        for _ in range(_count_chats):
            _item_chats = reader.tgread_object()
            _list_chats.append(_item_chats)
        _args['chats'] = _list_chats
        reader.read_int(signed=False)  # skip vector id
        _count_users = reader.read_int()
        _list_users = []
        for _ in range(_count_users):
            _item_users = reader.tgread_object()
            _list_users.append(_item_users)
        _args['users'] = _list_users
        return cls(**_args)


class ChatInviteImporters(TLObject):
    """TL type: messages.chatInviteImporters"""
    CONSTRUCTOR_ID = 0x81b6b00a
    SUBCLASS_OF_ID = 0xd9bc8aa6

    def __init__(self, count: int, importers: List['TypeChatInviteImporter'], users: List['TypeUser']):
        self.count = count
        self.importers = importers
        self.users = users

    def to_dict(self):
        return {
            '_': 'ChatInviteImporters',
            'count': self.count,
            'importers': self.importers,
            'users': self.users,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', self.count))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.importers)))
        for item in self.importers:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.users)))
        for item in self.users:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_count = reader.read_int()
        _args['count'] = _val_count
        reader.read_int(signed=False)  # skip vector id
        _count_importers = reader.read_int()
        _list_importers = []
        for _ in range(_count_importers):
            _item_importers = reader.tgread_object()
            _list_importers.append(_item_importers)
        _args['importers'] = _list_importers
        reader.read_int(signed=False)  # skip vector id
        _count_users = reader.read_int()
        _list_users = []
        for _ in range(_count_users):
            _item_users = reader.tgread_object()
            _list_users.append(_item_users)
        _args['users'] = _list_users
        return cls(**_args)


class Chats(TLObject):
    """TL type: messages.chats"""
    CONSTRUCTOR_ID = 0x64ff9fd5
    SUBCLASS_OF_ID = 0x99d5cb14

    def __init__(self, chats: List['TypeChat']):
        self.chats = chats

    def to_dict(self):
        return {
            '_': 'Chats',
            'chats': self.chats,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.chats)))
        for item in self.chats:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        reader.read_int(signed=False)  # skip vector id
        _count_chats = reader.read_int()
        _list_chats = []
        for _ in range(_count_chats):
            _item_chats = reader.tgread_object()
            _list_chats.append(_item_chats)
        _args['chats'] = _list_chats
        return cls(**_args)


class ChatsSlice(TLObject):
    """TL type: messages.chatsSlice"""
    CONSTRUCTOR_ID = 0x9cd81144
    SUBCLASS_OF_ID = 0x99d5cb14

    def __init__(self, count: int, chats: List['TypeChat']):
        self.count = count
        self.chats = chats

    def to_dict(self):
        return {
            '_': 'ChatsSlice',
            'count': self.count,
            'chats': self.chats,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', self.count))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.chats)))
        for item in self.chats:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_count = reader.read_int()
        _args['count'] = _val_count
        reader.read_int(signed=False)  # skip vector id
        _count_chats = reader.read_int()
        _list_chats = []
        for _ in range(_count_chats):
            _item_chats = reader.tgread_object()
            _list_chats.append(_item_chats)
        _args['chats'] = _list_chats
        return cls(**_args)


class CheckedHistoryImportPeer(TLObject):
    """TL type: messages.checkedHistoryImportPeer"""
    CONSTRUCTOR_ID = 0xa24de717
    SUBCLASS_OF_ID = 0xb84bb337

    def __init__(self, confirm_text: str):
        self.confirm_text = confirm_text

    def to_dict(self):
        return {
            '_': 'CheckedHistoryImportPeer',
            'confirm_text': self.confirm_text,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(TLObject.serialize_bytes(self.confirm_text))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_confirm_text = reader.tgread_string()
        _args['confirm_text'] = _val_confirm_text
        return cls(**_args)


class DhConfig(TLObject):
    """TL type: messages.dhConfig"""
    CONSTRUCTOR_ID = 0x2c221edd
    SUBCLASS_OF_ID = 0xe488ed8b

    def __init__(self, g: int, p: bytes, version: int, random: bytes):
        self.g = g
        self.p = p
        self.version = version
        self.random = random

    def to_dict(self):
        return {
            '_': 'DhConfig',
            'g': self.g,
            'p': self.p,
            'version': self.version,
            'random': self.random,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', self.g))
        buf.write(TLObject.serialize_bytes(self.p))
        buf.write(struct.pack('<i', self.version))
        buf.write(TLObject.serialize_bytes(self.random))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_g = reader.read_int()
        _args['g'] = _val_g
        _val_p = reader.tgread_bytes()
        _args['p'] = _val_p
        _val_version = reader.read_int()
        _args['version'] = _val_version
        _val_random = reader.tgread_bytes()
        _args['random'] = _val_random
        return cls(**_args)


class DhConfigNotModified(TLObject):
    """TL type: messages.dhConfigNotModified"""
    CONSTRUCTOR_ID = 0xc0e24635
    SUBCLASS_OF_ID = 0xe488ed8b

    def __init__(self, random: bytes):
        self.random = random

    def to_dict(self):
        return {
            '_': 'DhConfigNotModified',
            'random': self.random,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(TLObject.serialize_bytes(self.random))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_random = reader.tgread_bytes()
        _args['random'] = _val_random
        return cls(**_args)


class DialogFilters(TLObject):
    """TL type: messages.dialogFilters"""
    CONSTRUCTOR_ID = 0x2ad93719
    SUBCLASS_OF_ID = 0xa5fff1b7

    def __init__(self, filters: List['TypeDialogFilter'], tags_enabled: Optional[bool] = None):
        self.filters = filters
        self.tags_enabled = tags_enabled

    def to_dict(self):
        return {
            '_': 'DialogFilters',
            'filters': self.filters,
            'tags_enabled': self.tags_enabled,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        flags = 0
        if self.tags_enabled:
            flags |= (1 << 0)
        buf.write(struct.pack('<I', flags))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.filters)))
        for item in self.filters:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        flags = reader.read_int(signed=False)
        _args['tags_enabled'] = bool(flags & (1 << 0))
        reader.read_int(signed=False)  # skip vector id
        _count_filters = reader.read_int()
        _list_filters = []
        for _ in range(_count_filters):
            _item_filters = reader.tgread_object()
            _list_filters.append(_item_filters)
        _args['filters'] = _list_filters
        return cls(**_args)


class Dialogs(TLObject):
    """TL type: messages.dialogs"""
    CONSTRUCTOR_ID = 0x15ba6c40
    SUBCLASS_OF_ID = 0x0e1b52ee

    def __init__(self, dialogs: List['TypeDialog'], messages: List['TypeMessage'], chats: List['TypeChat'], users: List['TypeUser']):
        self.dialogs = dialogs
        self.messages = messages
        self.chats = chats
        self.users = users

    def to_dict(self):
        return {
            '_': 'Dialogs',
            'dialogs': self.dialogs,
            'messages': self.messages,
            'chats': self.chats,
            'users': self.users,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.dialogs)))
        for item in self.dialogs:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.messages)))
        for item in self.messages:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.chats)))
        for item in self.chats:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.users)))
        for item in self.users:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        reader.read_int(signed=False)  # skip vector id
        _count_dialogs = reader.read_int()
        _list_dialogs = []
        for _ in range(_count_dialogs):
            _item_dialogs = reader.tgread_object()
            _list_dialogs.append(_item_dialogs)
        _args['dialogs'] = _list_dialogs
        reader.read_int(signed=False)  # skip vector id
        _count_messages = reader.read_int()
        _list_messages = []
        for _ in range(_count_messages):
            _item_messages = reader.tgread_object()
            _list_messages.append(_item_messages)
        _args['messages'] = _list_messages
        reader.read_int(signed=False)  # skip vector id
        _count_chats = reader.read_int()
        _list_chats = []
        for _ in range(_count_chats):
            _item_chats = reader.tgread_object()
            _list_chats.append(_item_chats)
        _args['chats'] = _list_chats
        reader.read_int(signed=False)  # skip vector id
        _count_users = reader.read_int()
        _list_users = []
        for _ in range(_count_users):
            _item_users = reader.tgread_object()
            _list_users.append(_item_users)
        _args['users'] = _list_users
        return cls(**_args)


class DialogsNotModified(TLObject):
    """TL type: messages.dialogsNotModified"""
    CONSTRUCTOR_ID = 0xf0e3e596
    SUBCLASS_OF_ID = 0x0e1b52ee

    def __init__(self, count: int):
        self.count = count

    def to_dict(self):
        return {
            '_': 'DialogsNotModified',
            'count': self.count,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', self.count))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_count = reader.read_int()
        _args['count'] = _val_count
        return cls(**_args)


class DialogsSlice(TLObject):
    """TL type: messages.dialogsSlice"""
    CONSTRUCTOR_ID = 0x71e094f3
    SUBCLASS_OF_ID = 0x0e1b52ee

    def __init__(self, count: int, dialogs: List['TypeDialog'], messages: List['TypeMessage'], chats: List['TypeChat'], users: List['TypeUser']):
        self.count = count
        self.dialogs = dialogs
        self.messages = messages
        self.chats = chats
        self.users = users

    def to_dict(self):
        return {
            '_': 'DialogsSlice',
            'count': self.count,
            'dialogs': self.dialogs,
            'messages': self.messages,
            'chats': self.chats,
            'users': self.users,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', self.count))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.dialogs)))
        for item in self.dialogs:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.messages)))
        for item in self.messages:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.chats)))
        for item in self.chats:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.users)))
        for item in self.users:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_count = reader.read_int()
        _args['count'] = _val_count
        reader.read_int(signed=False)  # skip vector id
        _count_dialogs = reader.read_int()
        _list_dialogs = []
        for _ in range(_count_dialogs):
            _item_dialogs = reader.tgread_object()
            _list_dialogs.append(_item_dialogs)
        _args['dialogs'] = _list_dialogs
        reader.read_int(signed=False)  # skip vector id
        _count_messages = reader.read_int()
        _list_messages = []
        for _ in range(_count_messages):
            _item_messages = reader.tgread_object()
            _list_messages.append(_item_messages)
        _args['messages'] = _list_messages
        reader.read_int(signed=False)  # skip vector id
        _count_chats = reader.read_int()
        _list_chats = []
        for _ in range(_count_chats):
            _item_chats = reader.tgread_object()
            _list_chats.append(_item_chats)
        _args['chats'] = _list_chats
        reader.read_int(signed=False)  # skip vector id
        _count_users = reader.read_int()
        _list_users = []
        for _ in range(_count_users):
            _item_users = reader.tgread_object()
            _list_users.append(_item_users)
        _args['users'] = _list_users
        return cls(**_args)


class DiscussionMessage(TLObject):
    """TL type: messages.discussionMessage"""
    CONSTRUCTOR_ID = 0xa6341782
    SUBCLASS_OF_ID = 0x53f8e3e8

    def __init__(self, messages: List['TypeMessage'], unread_count: int, chats: List['TypeChat'], users: List['TypeUser'], max_id: Optional[int] = None, read_inbox_max_id: Optional[int] = None, read_outbox_max_id: Optional[int] = None):
        self.messages = messages
        self.unread_count = unread_count
        self.chats = chats
        self.users = users
        self.max_id = max_id
        self.read_inbox_max_id = read_inbox_max_id
        self.read_outbox_max_id = read_outbox_max_id

    def to_dict(self):
        return {
            '_': 'DiscussionMessage',
            'messages': self.messages,
            'unread_count': self.unread_count,
            'chats': self.chats,
            'users': self.users,
            'max_id': self.max_id,
            'read_inbox_max_id': self.read_inbox_max_id,
            'read_outbox_max_id': self.read_outbox_max_id,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        flags = 0
        if self.max_id is not None:
            flags |= (1 << 0)
        if self.read_inbox_max_id is not None:
            flags |= (1 << 1)
        if self.read_outbox_max_id is not None:
            flags |= (1 << 2)
        buf.write(struct.pack('<I', flags))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.messages)))
        for item in self.messages:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', self.unread_count))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.chats)))
        for item in self.chats:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.users)))
        for item in self.users:
            buf.write(bytes(self.item))
        if self.max_id is not None:
            buf.write(struct.pack('<i', self.max_id))
        if self.read_inbox_max_id is not None:
            buf.write(struct.pack('<i', self.read_inbox_max_id))
        if self.read_outbox_max_id is not None:
            buf.write(struct.pack('<i', self.read_outbox_max_id))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        flags = reader.read_int(signed=False)
        reader.read_int(signed=False)  # skip vector id
        _count_messages = reader.read_int()
        _list_messages = []
        for _ in range(_count_messages):
            _item_messages = reader.tgread_object()
            _list_messages.append(_item_messages)
        _args['messages'] = _list_messages
        if flags & (1 << 0):
            _val_max_id = reader.read_int()
            _args['max_id'] = _val_max_id
        else:
            _args['max_id'] = None
        if flags & (1 << 1):
            _val_read_inbox_max_id = reader.read_int()
            _args['read_inbox_max_id'] = _val_read_inbox_max_id
        else:
            _args['read_inbox_max_id'] = None
        if flags & (1 << 2):
            _val_read_outbox_max_id = reader.read_int()
            _args['read_outbox_max_id'] = _val_read_outbox_max_id
        else:
            _args['read_outbox_max_id'] = None
        _val_unread_count = reader.read_int()
        _args['unread_count'] = _val_unread_count
        reader.read_int(signed=False)  # skip vector id
        _count_chats = reader.read_int()
        _list_chats = []
        for _ in range(_count_chats):
            _item_chats = reader.tgread_object()
            _list_chats.append(_item_chats)
        _args['chats'] = _list_chats
        reader.read_int(signed=False)  # skip vector id
        _count_users = reader.read_int()
        _list_users = []
        for _ in range(_count_users):
            _item_users = reader.tgread_object()
            _list_users.append(_item_users)
        _args['users'] = _list_users
        return cls(**_args)


class EmojiGameDiceInfo(TLObject):
    """TL type: messages.emojiGameDiceInfo"""
    CONSTRUCTOR_ID = 0x44e56023
    SUBCLASS_OF_ID = 0x064b3022

    def __init__(self, game_hash: str, prev_stake: int, current_streak: int, params: List[int], plays_left: Optional[int] = None):
        self.game_hash = game_hash
        self.prev_stake = prev_stake
        self.current_streak = current_streak
        self.params = params
        self.plays_left = plays_left

    def to_dict(self):
        return {
            '_': 'EmojiGameDiceInfo',
            'game_hash': self.game_hash,
            'prev_stake': self.prev_stake,
            'current_streak': self.current_streak,
            'params': self.params,
            'plays_left': self.plays_left,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        flags = 0
        if self.plays_left is not None:
            flags |= (1 << 0)
        buf.write(struct.pack('<I', flags))
        buf.write(TLObject.serialize_bytes(self.game_hash))
        buf.write(struct.pack('<q', self.prev_stake))
        buf.write(struct.pack('<i', self.current_streak))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.params)))
        for item in self.params:
            buf.write(struct.pack('<i', self.item))
        if self.plays_left is not None:
            buf.write(struct.pack('<i', self.plays_left))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        flags = reader.read_int(signed=False)
        _val_game_hash = reader.tgread_string()
        _args['game_hash'] = _val_game_hash
        _val_prev_stake = reader.read_long()
        _args['prev_stake'] = _val_prev_stake
        _val_current_streak = reader.read_int()
        _args['current_streak'] = _val_current_streak
        reader.read_int(signed=False)  # skip vector id
        _count_params = reader.read_int()
        _list_params = []
        for _ in range(_count_params):
            _item_params = reader.read_int()
            _list_params.append(_item_params)
        _args['params'] = _list_params
        if flags & (1 << 0):
            _val_plays_left = reader.read_int()
            _args['plays_left'] = _val_plays_left
        else:
            _args['plays_left'] = None
        return cls(**_args)


class EmojiGameOutcome(TLObject):
    """TL type: messages.emojiGameOutcome"""
    CONSTRUCTOR_ID = 0xda2ad647
    SUBCLASS_OF_ID = 0x0ef75569

    def __init__(self, seed: bytes, stake_ton_amount: int, ton_amount: int):
        self.seed = seed
        self.stake_ton_amount = stake_ton_amount
        self.ton_amount = ton_amount

    def to_dict(self):
        return {
            '_': 'EmojiGameOutcome',
            'seed': self.seed,
            'stake_ton_amount': self.stake_ton_amount,
            'ton_amount': self.ton_amount,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(TLObject.serialize_bytes(self.seed))
        buf.write(struct.pack('<q', self.stake_ton_amount))
        buf.write(struct.pack('<q', self.ton_amount))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_seed = reader.tgread_bytes()
        _args['seed'] = _val_seed
        _val_stake_ton_amount = reader.read_long()
        _args['stake_ton_amount'] = _val_stake_ton_amount
        _val_ton_amount = reader.read_long()
        _args['ton_amount'] = _val_ton_amount
        return cls(**_args)


class EmojiGameUnavailable(TLObject):
    """TL type: messages.emojiGameUnavailable"""
    CONSTRUCTOR_ID = 0x59e65335
    SUBCLASS_OF_ID = 0x064b3022

    def __init__(self):
        pass

    def to_dict(self):
        return {
            '_': 'EmojiGameUnavailable',
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        return cls()


class EmojiGroups(TLObject):
    """TL type: messages.emojiGroups"""
    CONSTRUCTOR_ID = 0x881fb94b
    SUBCLASS_OF_ID = 0x7eca55d9

    def __init__(self, hash: int, groups: List['TypeEmojiGroup']):
        self.hash = hash
        self.groups = groups

    def to_dict(self):
        return {
            '_': 'EmojiGroups',
            'hash': self.hash,
            'groups': self.groups,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', self.hash))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.groups)))
        for item in self.groups:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_hash = reader.read_int()
        _args['hash'] = _val_hash
        reader.read_int(signed=False)  # skip vector id
        _count_groups = reader.read_int()
        _list_groups = []
        for _ in range(_count_groups):
            _item_groups = reader.tgread_object()
            _list_groups.append(_item_groups)
        _args['groups'] = _list_groups
        return cls(**_args)


class EmojiGroupsNotModified(TLObject):
    """TL type: messages.emojiGroupsNotModified"""
    CONSTRUCTOR_ID = 0x6fb4ad87
    SUBCLASS_OF_ID = 0x7eca55d9

    def __init__(self):
        pass

    def to_dict(self):
        return {
            '_': 'EmojiGroupsNotModified',
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        return cls()


class ExportedChatInvite(TLObject):
    """TL type: messages.exportedChatInvite"""
    CONSTRUCTOR_ID = 0x1871be50
    SUBCLASS_OF_ID = 0x82dcd4ca

    def __init__(self, invite: 'TypeExportedChatInvite', users: List['TypeUser']):
        self.invite = invite
        self.users = users

    def to_dict(self):
        return {
            '_': 'ExportedChatInvite',
            'invite': self.invite,
            'users': self.users,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(bytes(self.invite))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.users)))
        for item in self.users:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_invite = reader.tgread_object()
        _args['invite'] = _val_invite
        reader.read_int(signed=False)  # skip vector id
        _count_users = reader.read_int()
        _list_users = []
        for _ in range(_count_users):
            _item_users = reader.tgread_object()
            _list_users.append(_item_users)
        _args['users'] = _list_users
        return cls(**_args)


class ExportedChatInviteReplaced(TLObject):
    """TL type: messages.exportedChatInviteReplaced"""
    CONSTRUCTOR_ID = 0x222600ef
    SUBCLASS_OF_ID = 0x82dcd4ca

    def __init__(self, invite: 'TypeExportedChatInvite', new_invite: 'TypeExportedChatInvite', users: List['TypeUser']):
        self.invite = invite
        self.new_invite = new_invite
        self.users = users

    def to_dict(self):
        return {
            '_': 'ExportedChatInviteReplaced',
            'invite': self.invite,
            'new_invite': self.new_invite,
            'users': self.users,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(bytes(self.invite))
        buf.write(bytes(self.new_invite))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.users)))
        for item in self.users:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_invite = reader.tgread_object()
        _args['invite'] = _val_invite
        _val_new_invite = reader.tgread_object()
        _args['new_invite'] = _val_new_invite
        reader.read_int(signed=False)  # skip vector id
        _count_users = reader.read_int()
        _list_users = []
        for _ in range(_count_users):
            _item_users = reader.tgread_object()
            _list_users.append(_item_users)
        _args['users'] = _list_users
        return cls(**_args)


class ExportedChatInvites(TLObject):
    """TL type: messages.exportedChatInvites"""
    CONSTRUCTOR_ID = 0xbdc62dcc
    SUBCLASS_OF_ID = 0x603d3871

    def __init__(self, count: int, invites: List['TypeExportedChatInvite'], users: List['TypeUser']):
        self.count = count
        self.invites = invites
        self.users = users

    def to_dict(self):
        return {
            '_': 'ExportedChatInvites',
            'count': self.count,
            'invites': self.invites,
            'users': self.users,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', self.count))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.invites)))
        for item in self.invites:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.users)))
        for item in self.users:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_count = reader.read_int()
        _args['count'] = _val_count
        reader.read_int(signed=False)  # skip vector id
        _count_invites = reader.read_int()
        _list_invites = []
        for _ in range(_count_invites):
            _item_invites = reader.tgread_object()
            _list_invites.append(_item_invites)
        _args['invites'] = _list_invites
        reader.read_int(signed=False)  # skip vector id
        _count_users = reader.read_int()
        _list_users = []
        for _ in range(_count_users):
            _item_users = reader.tgread_object()
            _list_users.append(_item_users)
        _args['users'] = _list_users
        return cls(**_args)


class FavedStickers(TLObject):
    """TL type: messages.favedStickers"""
    CONSTRUCTOR_ID = 0x2cb51097
    SUBCLASS_OF_ID = 0x8e736fb9

    def __init__(self, hash: int, packs: List['TypeStickerPack'], stickers: List['TypeDocument']):
        self.hash = hash
        self.packs = packs
        self.stickers = stickers

    def to_dict(self):
        return {
            '_': 'FavedStickers',
            'hash': self.hash,
            'packs': self.packs,
            'stickers': self.stickers,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<q', self.hash))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.packs)))
        for item in self.packs:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.stickers)))
        for item in self.stickers:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_hash = reader.read_long()
        _args['hash'] = _val_hash
        reader.read_int(signed=False)  # skip vector id
        _count_packs = reader.read_int()
        _list_packs = []
        for _ in range(_count_packs):
            _item_packs = reader.tgread_object()
            _list_packs.append(_item_packs)
        _args['packs'] = _list_packs
        reader.read_int(signed=False)  # skip vector id
        _count_stickers = reader.read_int()
        _list_stickers = []
        for _ in range(_count_stickers):
            _item_stickers = reader.tgread_object()
            _list_stickers.append(_item_stickers)
        _args['stickers'] = _list_stickers
        return cls(**_args)


class FavedStickersNotModified(TLObject):
    """TL type: messages.favedStickersNotModified"""
    CONSTRUCTOR_ID = 0x9e8fa6d3
    SUBCLASS_OF_ID = 0x8e736fb9

    def __init__(self):
        pass

    def to_dict(self):
        return {
            '_': 'FavedStickersNotModified',
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        return cls()


class FeaturedStickers(TLObject):
    """TL type: messages.featuredStickers"""
    CONSTRUCTOR_ID = 0xbe382906
    SUBCLASS_OF_ID = 0x2614b722

    def __init__(self, hash: int, count: int, sets: List['TypeStickerSetCovered'], unread: List[int], premium: Optional[bool] = None):
        self.hash = hash
        self.count = count
        self.sets = sets
        self.unread = unread
        self.premium = premium

    def to_dict(self):
        return {
            '_': 'FeaturedStickers',
            'hash': self.hash,
            'count': self.count,
            'sets': self.sets,
            'unread': self.unread,
            'premium': self.premium,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        flags = 0
        if self.premium:
            flags |= (1 << 0)
        buf.write(struct.pack('<I', flags))
        buf.write(struct.pack('<q', self.hash))
        buf.write(struct.pack('<i', self.count))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.sets)))
        for item in self.sets:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.unread)))
        for item in self.unread:
            buf.write(struct.pack('<q', self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        flags = reader.read_int(signed=False)
        _args['premium'] = bool(flags & (1 << 0))
        _val_hash = reader.read_long()
        _args['hash'] = _val_hash
        _val_count = reader.read_int()
        _args['count'] = _val_count
        reader.read_int(signed=False)  # skip vector id
        _count_sets = reader.read_int()
        _list_sets = []
        for _ in range(_count_sets):
            _item_sets = reader.tgread_object()
            _list_sets.append(_item_sets)
        _args['sets'] = _list_sets
        reader.read_int(signed=False)  # skip vector id
        _count_unread = reader.read_int()
        _list_unread = []
        for _ in range(_count_unread):
            _item_unread = reader.read_long()
            _list_unread.append(_item_unread)
        _args['unread'] = _list_unread
        return cls(**_args)


class FeaturedStickersNotModified(TLObject):
    """TL type: messages.featuredStickersNotModified"""
    CONSTRUCTOR_ID = 0xc6dc0c66
    SUBCLASS_OF_ID = 0x2614b722

    def __init__(self, count: int):
        self.count = count

    def to_dict(self):
        return {
            '_': 'FeaturedStickersNotModified',
            'count': self.count,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', self.count))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_count = reader.read_int()
        _args['count'] = _val_count
        return cls(**_args)


class ForumTopics(TLObject):
    """TL type: messages.forumTopics"""
    CONSTRUCTOR_ID = 0x367617d3
    SUBCLASS_OF_ID = 0x8e1d3e1e

    def __init__(self, count: int, topics: List['TypeForumTopic'], messages: List['TypeMessage'], chats: List['TypeChat'], users: List['TypeUser'], pts: int, order_by_create_date: Optional[bool] = None):
        self.count = count
        self.topics = topics
        self.messages = messages
        self.chats = chats
        self.users = users
        self.pts = pts
        self.order_by_create_date = order_by_create_date

    def to_dict(self):
        return {
            '_': 'ForumTopics',
            'count': self.count,
            'topics': self.topics,
            'messages': self.messages,
            'chats': self.chats,
            'users': self.users,
            'pts': self.pts,
            'order_by_create_date': self.order_by_create_date,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        flags = 0
        if self.order_by_create_date:
            flags |= (1 << 0)
        buf.write(struct.pack('<I', flags))
        buf.write(struct.pack('<i', self.count))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.topics)))
        for item in self.topics:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.messages)))
        for item in self.messages:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.chats)))
        for item in self.chats:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.users)))
        for item in self.users:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', self.pts))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        flags = reader.read_int(signed=False)
        _args['order_by_create_date'] = bool(flags & (1 << 0))
        _val_count = reader.read_int()
        _args['count'] = _val_count
        reader.read_int(signed=False)  # skip vector id
        _count_topics = reader.read_int()
        _list_topics = []
        for _ in range(_count_topics):
            _item_topics = reader.tgread_object()
            _list_topics.append(_item_topics)
        _args['topics'] = _list_topics
        reader.read_int(signed=False)  # skip vector id
        _count_messages = reader.read_int()
        _list_messages = []
        for _ in range(_count_messages):
            _item_messages = reader.tgread_object()
            _list_messages.append(_item_messages)
        _args['messages'] = _list_messages
        reader.read_int(signed=False)  # skip vector id
        _count_chats = reader.read_int()
        _list_chats = []
        for _ in range(_count_chats):
            _item_chats = reader.tgread_object()
            _list_chats.append(_item_chats)
        _args['chats'] = _list_chats
        reader.read_int(signed=False)  # skip vector id
        _count_users = reader.read_int()
        _list_users = []
        for _ in range(_count_users):
            _item_users = reader.tgread_object()
            _list_users.append(_item_users)
        _args['users'] = _list_users
        _val_pts = reader.read_int()
        _args['pts'] = _val_pts
        return cls(**_args)


class FoundStickerSets(TLObject):
    """TL type: messages.foundStickerSets"""
    CONSTRUCTOR_ID = 0x8af09dd2
    SUBCLASS_OF_ID = 0x040df361

    def __init__(self, hash: int, sets: List['TypeStickerSetCovered']):
        self.hash = hash
        self.sets = sets

    def to_dict(self):
        return {
            '_': 'FoundStickerSets',
            'hash': self.hash,
            'sets': self.sets,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<q', self.hash))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.sets)))
        for item in self.sets:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_hash = reader.read_long()
        _args['hash'] = _val_hash
        reader.read_int(signed=False)  # skip vector id
        _count_sets = reader.read_int()
        _list_sets = []
        for _ in range(_count_sets):
            _item_sets = reader.tgread_object()
            _list_sets.append(_item_sets)
        _args['sets'] = _list_sets
        return cls(**_args)


class FoundStickerSetsNotModified(TLObject):
    """TL type: messages.foundStickerSetsNotModified"""
    CONSTRUCTOR_ID = 0x0d54b65d
    SUBCLASS_OF_ID = 0x040df361

    def __init__(self):
        pass

    def to_dict(self):
        return {
            '_': 'FoundStickerSetsNotModified',
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        return cls()


class FoundStickers(TLObject):
    """TL type: messages.foundStickers"""
    CONSTRUCTOR_ID = 0x82c9e290
    SUBCLASS_OF_ID = 0x06402151

    def __init__(self, hash: int, stickers: List['TypeDocument'], next_offset: Optional[int] = None):
        self.hash = hash
        self.stickers = stickers
        self.next_offset = next_offset

    def to_dict(self):
        return {
            '_': 'FoundStickers',
            'hash': self.hash,
            'stickers': self.stickers,
            'next_offset': self.next_offset,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        flags = 0
        if self.next_offset is not None:
            flags |= (1 << 0)
        buf.write(struct.pack('<I', flags))
        buf.write(struct.pack('<q', self.hash))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.stickers)))
        for item in self.stickers:
            buf.write(bytes(self.item))
        if self.next_offset is not None:
            buf.write(struct.pack('<i', self.next_offset))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        flags = reader.read_int(signed=False)
        if flags & (1 << 0):
            _val_next_offset = reader.read_int()
            _args['next_offset'] = _val_next_offset
        else:
            _args['next_offset'] = None
        _val_hash = reader.read_long()
        _args['hash'] = _val_hash
        reader.read_int(signed=False)  # skip vector id
        _count_stickers = reader.read_int()
        _list_stickers = []
        for _ in range(_count_stickers):
            _item_stickers = reader.tgread_object()
            _list_stickers.append(_item_stickers)
        _args['stickers'] = _list_stickers
        return cls(**_args)


class FoundStickersNotModified(TLObject):
    """TL type: messages.foundStickersNotModified"""
    CONSTRUCTOR_ID = 0x6010c534
    SUBCLASS_OF_ID = 0x06402151

    def __init__(self, next_offset: Optional[int] = None):
        self.next_offset = next_offset

    def to_dict(self):
        return {
            '_': 'FoundStickersNotModified',
            'next_offset': self.next_offset,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        flags = 0
        if self.next_offset is not None:
            flags |= (1 << 0)
        buf.write(struct.pack('<I', flags))
        if self.next_offset is not None:
            buf.write(struct.pack('<i', self.next_offset))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        flags = reader.read_int(signed=False)
        if flags & (1 << 0):
            _val_next_offset = reader.read_int()
            _args['next_offset'] = _val_next_offset
        else:
            _args['next_offset'] = None
        return cls(**_args)


class HighScores(TLObject):
    """TL type: messages.highScores"""
    CONSTRUCTOR_ID = 0x9a3bfd99
    SUBCLASS_OF_ID = 0x6ccd95fd

    def __init__(self, scores: List['TypeHighScore'], users: List['TypeUser']):
        self.scores = scores
        self.users = users

    def to_dict(self):
        return {
            '_': 'HighScores',
            'scores': self.scores,
            'users': self.users,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.scores)))
        for item in self.scores:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.users)))
        for item in self.users:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        reader.read_int(signed=False)  # skip vector id
        _count_scores = reader.read_int()
        _list_scores = []
        for _ in range(_count_scores):
            _item_scores = reader.tgread_object()
            _list_scores.append(_item_scores)
        _args['scores'] = _list_scores
        reader.read_int(signed=False)  # skip vector id
        _count_users = reader.read_int()
        _list_users = []
        for _ in range(_count_users):
            _item_users = reader.tgread_object()
            _list_users.append(_item_users)
        _args['users'] = _list_users
        return cls(**_args)


class HistoryImport(TLObject):
    """TL type: messages.historyImport"""
    CONSTRUCTOR_ID = 0x1662af0b
    SUBCLASS_OF_ID = 0xb18bb50a

    def __init__(self, id: int):
        self.id = id

    def to_dict(self):
        return {
            '_': 'HistoryImport',
            'id': self.id,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<q', self.id))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_id = reader.read_long()
        _args['id'] = _val_id
        return cls(**_args)


class HistoryImportParsed(TLObject):
    """TL type: messages.historyImportParsed"""
    CONSTRUCTOR_ID = 0x5e0fb7b9
    SUBCLASS_OF_ID = 0x5bb2720b

    def __init__(self, pm: Optional[bool] = None, group: Optional[bool] = None, title: Optional[str] = None):
        self.pm = pm
        self.group = group
        self.title = title

    def to_dict(self):
        return {
            '_': 'HistoryImportParsed',
            'pm': self.pm,
            'group': self.group,
            'title': self.title,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        flags = 0
        if self.pm:
            flags |= (1 << 0)
        if self.group:
            flags |= (1 << 1)
        if self.title is not None:
            flags |= (1 << 2)
        buf.write(struct.pack('<I', flags))
        if self.title is not None:
            buf.write(TLObject.serialize_bytes(self.title))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        flags = reader.read_int(signed=False)
        _args['pm'] = bool(flags & (1 << 0))
        _args['group'] = bool(flags & (1 << 1))
        if flags & (1 << 2):
            _val_title = reader.tgread_string()
            _args['title'] = _val_title
        else:
            _args['title'] = None
        return cls(**_args)


class InactiveChats(TLObject):
    """TL type: messages.inactiveChats"""
    CONSTRUCTOR_ID = 0xa927fec5
    SUBCLASS_OF_ID = 0x8bf3d7d4

    def __init__(self, dates: List[int], chats: List['TypeChat'], users: List['TypeUser']):
        self.dates = dates
        self.chats = chats
        self.users = users

    def to_dict(self):
        return {
            '_': 'InactiveChats',
            'dates': self.dates,
            'chats': self.chats,
            'users': self.users,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.dates)))
        for item in self.dates:
            buf.write(struct.pack('<i', self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.chats)))
        for item in self.chats:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.users)))
        for item in self.users:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        reader.read_int(signed=False)  # skip vector id
        _count_dates = reader.read_int()
        _list_dates = []
        for _ in range(_count_dates):
            _item_dates = reader.read_int()
            _list_dates.append(_item_dates)
        _args['dates'] = _list_dates
        reader.read_int(signed=False)  # skip vector id
        _count_chats = reader.read_int()
        _list_chats = []
        for _ in range(_count_chats):
            _item_chats = reader.tgread_object()
            _list_chats.append(_item_chats)
        _args['chats'] = _list_chats
        reader.read_int(signed=False)  # skip vector id
        _count_users = reader.read_int()
        _list_users = []
        for _ in range(_count_users):
            _item_users = reader.tgread_object()
            _list_users.append(_item_users)
        _args['users'] = _list_users
        return cls(**_args)


class InvitedUsers(TLObject):
    """TL type: messages.invitedUsers"""
    CONSTRUCTOR_ID = 0x7f5defa6
    SUBCLASS_OF_ID = 0x3dbe90a1

    def __init__(self, updates: 'TypeUpdates', missing_invitees: List['TypeMissingInvitee']):
        self.updates = updates
        self.missing_invitees = missing_invitees

    def to_dict(self):
        return {
            '_': 'InvitedUsers',
            'updates': self.updates,
            'missing_invitees': self.missing_invitees,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(bytes(self.updates))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.missing_invitees)))
        for item in self.missing_invitees:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_updates = reader.tgread_object()
        _args['updates'] = _val_updates
        reader.read_int(signed=False)  # skip vector id
        _count_missing_invitees = reader.read_int()
        _list_missing_invitees = []
        for _ in range(_count_missing_invitees):
            _item_missing_invitees = reader.tgread_object()
            _list_missing_invitees.append(_item_missing_invitees)
        _args['missing_invitees'] = _list_missing_invitees
        return cls(**_args)


class MessageEditData(TLObject):
    """TL type: messages.messageEditData"""
    CONSTRUCTOR_ID = 0x26b5dde6
    SUBCLASS_OF_ID = 0xfb47949d

    def __init__(self, caption: Optional[bool] = None):
        self.caption = caption

    def to_dict(self):
        return {
            '_': 'MessageEditData',
            'caption': self.caption,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        flags = 0
        if self.caption:
            flags |= (1 << 0)
        buf.write(struct.pack('<I', flags))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        flags = reader.read_int(signed=False)
        _args['caption'] = bool(flags & (1 << 0))
        return cls(**_args)


class MessageEmpty(TLObject):
    """TL type: messages.messageEmpty"""
    CONSTRUCTOR_ID = 0x3f4e0648
    SUBCLASS_OF_ID = 0xd6824adf

    def __init__(self):
        pass

    def to_dict(self):
        return {
            '_': 'MessageEmpty',
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        return cls()


class MessageReactionsList(TLObject):
    """TL type: messages.messageReactionsList"""
    CONSTRUCTOR_ID = 0x31bd492d
    SUBCLASS_OF_ID = 0x60fce5e6

    def __init__(self, count: int, reactions: List['TypeMessagePeerReaction'], chats: List['TypeChat'], users: List['TypeUser'], next_offset: Optional[str] = None):
        self.count = count
        self.reactions = reactions
        self.chats = chats
        self.users = users
        self.next_offset = next_offset

    def to_dict(self):
        return {
            '_': 'MessageReactionsList',
            'count': self.count,
            'reactions': self.reactions,
            'chats': self.chats,
            'users': self.users,
            'next_offset': self.next_offset,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        flags = 0
        if self.next_offset is not None:
            flags |= (1 << 0)
        buf.write(struct.pack('<I', flags))
        buf.write(struct.pack('<i', self.count))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.reactions)))
        for item in self.reactions:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.chats)))
        for item in self.chats:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.users)))
        for item in self.users:
            buf.write(bytes(self.item))
        if self.next_offset is not None:
            buf.write(TLObject.serialize_bytes(self.next_offset))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        flags = reader.read_int(signed=False)
        _val_count = reader.read_int()
        _args['count'] = _val_count
        reader.read_int(signed=False)  # skip vector id
        _count_reactions = reader.read_int()
        _list_reactions = []
        for _ in range(_count_reactions):
            _item_reactions = reader.tgread_object()
            _list_reactions.append(_item_reactions)
        _args['reactions'] = _list_reactions
        reader.read_int(signed=False)  # skip vector id
        _count_chats = reader.read_int()
        _list_chats = []
        for _ in range(_count_chats):
            _item_chats = reader.tgread_object()
            _list_chats.append(_item_chats)
        _args['chats'] = _list_chats
        reader.read_int(signed=False)  # skip vector id
        _count_users = reader.read_int()
        _list_users = []
        for _ in range(_count_users):
            _item_users = reader.tgread_object()
            _list_users.append(_item_users)
        _args['users'] = _list_users
        if flags & (1 << 0):
            _val_next_offset = reader.tgread_string()
            _args['next_offset'] = _val_next_offset
        else:
            _args['next_offset'] = None
        return cls(**_args)


class MessageViews(TLObject):
    """TL type: messages.messageViews"""
    CONSTRUCTOR_ID = 0xb6c4f543
    SUBCLASS_OF_ID = 0xafb5eb9c

    def __init__(self, views: List['TypeMessageViews'], chats: List['TypeChat'], users: List['TypeUser']):
        self.views = views
        self.chats = chats
        self.users = users

    def to_dict(self):
        return {
            '_': 'MessageViews',
            'views': self.views,
            'chats': self.chats,
            'users': self.users,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.views)))
        for item in self.views:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.chats)))
        for item in self.chats:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.users)))
        for item in self.users:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        reader.read_int(signed=False)  # skip vector id
        _count_views = reader.read_int()
        _list_views = []
        for _ in range(_count_views):
            _item_views = reader.tgread_object()
            _list_views.append(_item_views)
        _args['views'] = _list_views
        reader.read_int(signed=False)  # skip vector id
        _count_chats = reader.read_int()
        _list_chats = []
        for _ in range(_count_chats):
            _item_chats = reader.tgread_object()
            _list_chats.append(_item_chats)
        _args['chats'] = _list_chats
        reader.read_int(signed=False)  # skip vector id
        _count_users = reader.read_int()
        _list_users = []
        for _ in range(_count_users):
            _item_users = reader.tgread_object()
            _list_users.append(_item_users)
        _args['users'] = _list_users
        return cls(**_args)


class Messages(TLObject):
    """TL type: messages.messages"""
    CONSTRUCTOR_ID = 0x1d73e7ea
    SUBCLASS_OF_ID = 0xd4b40b5e

    def __init__(self, messages: List['TypeMessage'], topics: List['TypeForumTopic'], chats: List['TypeChat'], users: List['TypeUser']):
        self.messages = messages
        self.topics = topics
        self.chats = chats
        self.users = users

    def to_dict(self):
        return {
            '_': 'Messages',
            'messages': self.messages,
            'topics': self.topics,
            'chats': self.chats,
            'users': self.users,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.messages)))
        for item in self.messages:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.topics)))
        for item in self.topics:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.chats)))
        for item in self.chats:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.users)))
        for item in self.users:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        reader.read_int(signed=False)  # skip vector id
        _count_messages = reader.read_int()
        _list_messages = []
        for _ in range(_count_messages):
            _item_messages = reader.tgread_object()
            _list_messages.append(_item_messages)
        _args['messages'] = _list_messages
        reader.read_int(signed=False)  # skip vector id
        _count_topics = reader.read_int()
        _list_topics = []
        for _ in range(_count_topics):
            _item_topics = reader.tgread_object()
            _list_topics.append(_item_topics)
        _args['topics'] = _list_topics
        reader.read_int(signed=False)  # skip vector id
        _count_chats = reader.read_int()
        _list_chats = []
        for _ in range(_count_chats):
            _item_chats = reader.tgread_object()
            _list_chats.append(_item_chats)
        _args['chats'] = _list_chats
        reader.read_int(signed=False)  # skip vector id
        _count_users = reader.read_int()
        _list_users = []
        for _ in range(_count_users):
            _item_users = reader.tgread_object()
            _list_users.append(_item_users)
        _args['users'] = _list_users
        return cls(**_args)


class MessagesNotModified(TLObject):
    """TL type: messages.messagesNotModified"""
    CONSTRUCTOR_ID = 0x74535f21
    SUBCLASS_OF_ID = 0xd4b40b5e

    def __init__(self, count: int):
        self.count = count

    def to_dict(self):
        return {
            '_': 'MessagesNotModified',
            'count': self.count,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', self.count))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_count = reader.read_int()
        _args['count'] = _val_count
        return cls(**_args)


class MessagesSlice(TLObject):
    """TL type: messages.messagesSlice"""
    CONSTRUCTOR_ID = 0x5f206716
    SUBCLASS_OF_ID = 0xd4b40b5e

    def __init__(self, count: int, messages: List['TypeMessage'], topics: List['TypeForumTopic'], chats: List['TypeChat'], users: List['TypeUser'], inexact: Optional[bool] = None, next_rate: Optional[int] = None, offset_id_offset: Optional[int] = None, search_flood: Optional['TypeSearchPostsFlood'] = None):
        self.count = count
        self.messages = messages
        self.topics = topics
        self.chats = chats
        self.users = users
        self.inexact = inexact
        self.next_rate = next_rate
        self.offset_id_offset = offset_id_offset
        self.search_flood = search_flood

    def to_dict(self):
        return {
            '_': 'MessagesSlice',
            'count': self.count,
            'messages': self.messages,
            'topics': self.topics,
            'chats': self.chats,
            'users': self.users,
            'inexact': self.inexact,
            'next_rate': self.next_rate,
            'offset_id_offset': self.offset_id_offset,
            'search_flood': self.search_flood,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        flags = 0
        if self.inexact:
            flags |= (1 << 1)
        if self.next_rate is not None:
            flags |= (1 << 0)
        if self.offset_id_offset is not None:
            flags |= (1 << 2)
        if self.search_flood is not None:
            flags |= (1 << 3)
        buf.write(struct.pack('<I', flags))
        buf.write(struct.pack('<i', self.count))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.messages)))
        for item in self.messages:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.topics)))
        for item in self.topics:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.chats)))
        for item in self.chats:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.users)))
        for item in self.users:
            buf.write(bytes(self.item))
        if self.next_rate is not None:
            buf.write(struct.pack('<i', self.next_rate))
        if self.offset_id_offset is not None:
            buf.write(struct.pack('<i', self.offset_id_offset))
        if self.search_flood is not None:
            buf.write(bytes(self.search_flood))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        flags = reader.read_int(signed=False)
        _args['inexact'] = bool(flags & (1 << 1))
        _val_count = reader.read_int()
        _args['count'] = _val_count
        if flags & (1 << 0):
            _val_next_rate = reader.read_int()
            _args['next_rate'] = _val_next_rate
        else:
            _args['next_rate'] = None
        if flags & (1 << 2):
            _val_offset_id_offset = reader.read_int()
            _args['offset_id_offset'] = _val_offset_id_offset
        else:
            _args['offset_id_offset'] = None
        if flags & (1 << 3):
            _val_search_flood = reader.tgread_object()
            _args['search_flood'] = _val_search_flood
        else:
            _args['search_flood'] = None
        reader.read_int(signed=False)  # skip vector id
        _count_messages = reader.read_int()
        _list_messages = []
        for _ in range(_count_messages):
            _item_messages = reader.tgread_object()
            _list_messages.append(_item_messages)
        _args['messages'] = _list_messages
        reader.read_int(signed=False)  # skip vector id
        _count_topics = reader.read_int()
        _list_topics = []
        for _ in range(_count_topics):
            _item_topics = reader.tgread_object()
            _list_topics.append(_item_topics)
        _args['topics'] = _list_topics
        reader.read_int(signed=False)  # skip vector id
        _count_chats = reader.read_int()
        _list_chats = []
        for _ in range(_count_chats):
            _item_chats = reader.tgread_object()
            _list_chats.append(_item_chats)
        _args['chats'] = _list_chats
        reader.read_int(signed=False)  # skip vector id
        _count_users = reader.read_int()
        _list_users = []
        for _ in range(_count_users):
            _item_users = reader.tgread_object()
            _list_users.append(_item_users)
        _args['users'] = _list_users
        return cls(**_args)


class MyStickers(TLObject):
    """TL type: messages.myStickers"""
    CONSTRUCTOR_ID = 0xfaff629d
    SUBCLASS_OF_ID = 0xb1b4350a

    def __init__(self, count: int, sets: List['TypeStickerSetCovered']):
        self.count = count
        self.sets = sets

    def to_dict(self):
        return {
            '_': 'MyStickers',
            'count': self.count,
            'sets': self.sets,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', self.count))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.sets)))
        for item in self.sets:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_count = reader.read_int()
        _args['count'] = _val_count
        reader.read_int(signed=False)  # skip vector id
        _count_sets = reader.read_int()
        _list_sets = []
        for _ in range(_count_sets):
            _item_sets = reader.tgread_object()
            _list_sets.append(_item_sets)
        _args['sets'] = _list_sets
        return cls(**_args)


class PeerDialogs(TLObject):
    """TL type: messages.peerDialogs"""
    CONSTRUCTOR_ID = 0x3371c354
    SUBCLASS_OF_ID = 0x3ac70132

    def __init__(self, dialogs: List['TypeDialog'], messages: List['TypeMessage'], chats: List['TypeChat'], users: List['TypeUser'], state: 'TypeState'):
        self.dialogs = dialogs
        self.messages = messages
        self.chats = chats
        self.users = users
        self.state = state

    def to_dict(self):
        return {
            '_': 'PeerDialogs',
            'dialogs': self.dialogs,
            'messages': self.messages,
            'chats': self.chats,
            'users': self.users,
            'state': self.state,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.dialogs)))
        for item in self.dialogs:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.messages)))
        for item in self.messages:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.chats)))
        for item in self.chats:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.users)))
        for item in self.users:
            buf.write(bytes(self.item))
        buf.write(bytes(self.state))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        reader.read_int(signed=False)  # skip vector id
        _count_dialogs = reader.read_int()
        _list_dialogs = []
        for _ in range(_count_dialogs):
            _item_dialogs = reader.tgread_object()
            _list_dialogs.append(_item_dialogs)
        _args['dialogs'] = _list_dialogs
        reader.read_int(signed=False)  # skip vector id
        _count_messages = reader.read_int()
        _list_messages = []
        for _ in range(_count_messages):
            _item_messages = reader.tgread_object()
            _list_messages.append(_item_messages)
        _args['messages'] = _list_messages
        reader.read_int(signed=False)  # skip vector id
        _count_chats = reader.read_int()
        _list_chats = []
        for _ in range(_count_chats):
            _item_chats = reader.tgread_object()
            _list_chats.append(_item_chats)
        _args['chats'] = _list_chats
        reader.read_int(signed=False)  # skip vector id
        _count_users = reader.read_int()
        _list_users = []
        for _ in range(_count_users):
            _item_users = reader.tgread_object()
            _list_users.append(_item_users)
        _args['users'] = _list_users
        _val_state = reader.tgread_object()
        _args['state'] = _val_state
        return cls(**_args)


class PeerSettings(TLObject):
    """TL type: messages.peerSettings"""
    CONSTRUCTOR_ID = 0x6880b94d
    SUBCLASS_OF_ID = 0x65a2f7a1

    def __init__(self, settings: 'TypePeerSettings', chats: List['TypeChat'], users: List['TypeUser']):
        self.settings = settings
        self.chats = chats
        self.users = users

    def to_dict(self):
        return {
            '_': 'PeerSettings',
            'settings': self.settings,
            'chats': self.chats,
            'users': self.users,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(bytes(self.settings))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.chats)))
        for item in self.chats:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.users)))
        for item in self.users:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_settings = reader.tgread_object()
        _args['settings'] = _val_settings
        reader.read_int(signed=False)  # skip vector id
        _count_chats = reader.read_int()
        _list_chats = []
        for _ in range(_count_chats):
            _item_chats = reader.tgread_object()
            _list_chats.append(_item_chats)
        _args['chats'] = _list_chats
        reader.read_int(signed=False)  # skip vector id
        _count_users = reader.read_int()
        _list_users = []
        for _ in range(_count_users):
            _item_users = reader.tgread_object()
            _list_users.append(_item_users)
        _args['users'] = _list_users
        return cls(**_args)


class PreparedInlineMessage(TLObject):
    """TL type: messages.preparedInlineMessage"""
    CONSTRUCTOR_ID = 0xff57708d
    SUBCLASS_OF_ID = 0x490ddf4d

    def __init__(self, query_id: int, result: 'TypeBotInlineResult', peer_types: List['TypeInlineQueryPeerType'], cache_time: int, users: List['TypeUser']):
        self.query_id = query_id
        self.result = result
        self.peer_types = peer_types
        self.cache_time = cache_time
        self.users = users

    def to_dict(self):
        return {
            '_': 'PreparedInlineMessage',
            'query_id': self.query_id,
            'result': self.result,
            'peer_types': self.peer_types,
            'cache_time': self.cache_time,
            'users': self.users,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<q', self.query_id))
        buf.write(bytes(self.result))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.peer_types)))
        for item in self.peer_types:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', self.cache_time))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.users)))
        for item in self.users:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_query_id = reader.read_long()
        _args['query_id'] = _val_query_id
        _val_result = reader.tgread_object()
        _args['result'] = _val_result
        reader.read_int(signed=False)  # skip vector id
        _count_peer_types = reader.read_int()
        _list_peer_types = []
        for _ in range(_count_peer_types):
            _item_peer_types = reader.tgread_object()
            _list_peer_types.append(_item_peer_types)
        _args['peer_types'] = _list_peer_types
        _val_cache_time = reader.read_int()
        _args['cache_time'] = _val_cache_time
        reader.read_int(signed=False)  # skip vector id
        _count_users = reader.read_int()
        _list_users = []
        for _ in range(_count_users):
            _item_users = reader.tgread_object()
            _list_users.append(_item_users)
        _args['users'] = _list_users
        return cls(**_args)


class QuickReplies(TLObject):
    """TL type: messages.quickReplies"""
    CONSTRUCTOR_ID = 0xc68d6695
    SUBCLASS_OF_ID = 0xf737e966

    def __init__(self, quick_replies: List['TypeQuickReply'], messages: List['TypeMessage'], chats: List['TypeChat'], users: List['TypeUser']):
        self.quick_replies = quick_replies
        self.messages = messages
        self.chats = chats
        self.users = users

    def to_dict(self):
        return {
            '_': 'QuickReplies',
            'quick_replies': self.quick_replies,
            'messages': self.messages,
            'chats': self.chats,
            'users': self.users,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.quick_replies)))
        for item in self.quick_replies:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.messages)))
        for item in self.messages:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.chats)))
        for item in self.chats:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.users)))
        for item in self.users:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        reader.read_int(signed=False)  # skip vector id
        _count_quick_replies = reader.read_int()
        _list_quick_replies = []
        for _ in range(_count_quick_replies):
            _item_quick_replies = reader.tgread_object()
            _list_quick_replies.append(_item_quick_replies)
        _args['quick_replies'] = _list_quick_replies
        reader.read_int(signed=False)  # skip vector id
        _count_messages = reader.read_int()
        _list_messages = []
        for _ in range(_count_messages):
            _item_messages = reader.tgread_object()
            _list_messages.append(_item_messages)
        _args['messages'] = _list_messages
        reader.read_int(signed=False)  # skip vector id
        _count_chats = reader.read_int()
        _list_chats = []
        for _ in range(_count_chats):
            _item_chats = reader.tgread_object()
            _list_chats.append(_item_chats)
        _args['chats'] = _list_chats
        reader.read_int(signed=False)  # skip vector id
        _count_users = reader.read_int()
        _list_users = []
        for _ in range(_count_users):
            _item_users = reader.tgread_object()
            _list_users.append(_item_users)
        _args['users'] = _list_users
        return cls(**_args)


class QuickRepliesNotModified(TLObject):
    """TL type: messages.quickRepliesNotModified"""
    CONSTRUCTOR_ID = 0x5f91eb5b
    SUBCLASS_OF_ID = 0xf737e966

    def __init__(self):
        pass

    def to_dict(self):
        return {
            '_': 'QuickRepliesNotModified',
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        return cls()


class Reactions(TLObject):
    """TL type: messages.reactions"""
    CONSTRUCTOR_ID = 0xeafdf716
    SUBCLASS_OF_ID = 0xadc38324

    def __init__(self, hash: int, reactions: List['TypeReaction']):
        self.hash = hash
        self.reactions = reactions

    def to_dict(self):
        return {
            '_': 'Reactions',
            'hash': self.hash,
            'reactions': self.reactions,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<q', self.hash))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.reactions)))
        for item in self.reactions:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_hash = reader.read_long()
        _args['hash'] = _val_hash
        reader.read_int(signed=False)  # skip vector id
        _count_reactions = reader.read_int()
        _list_reactions = []
        for _ in range(_count_reactions):
            _item_reactions = reader.tgread_object()
            _list_reactions.append(_item_reactions)
        _args['reactions'] = _list_reactions
        return cls(**_args)


class ReactionsNotModified(TLObject):
    """TL type: messages.reactionsNotModified"""
    CONSTRUCTOR_ID = 0xb06fdbdf
    SUBCLASS_OF_ID = 0xadc38324

    def __init__(self):
        pass

    def to_dict(self):
        return {
            '_': 'ReactionsNotModified',
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        return cls()


class RecentStickers(TLObject):
    """TL type: messages.recentStickers"""
    CONSTRUCTOR_ID = 0x88d37c56
    SUBCLASS_OF_ID = 0xf76f8683

    def __init__(self, hash: int, packs: List['TypeStickerPack'], stickers: List['TypeDocument'], dates: List[int]):
        self.hash = hash
        self.packs = packs
        self.stickers = stickers
        self.dates = dates

    def to_dict(self):
        return {
            '_': 'RecentStickers',
            'hash': self.hash,
            'packs': self.packs,
            'stickers': self.stickers,
            'dates': self.dates,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<q', self.hash))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.packs)))
        for item in self.packs:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.stickers)))
        for item in self.stickers:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.dates)))
        for item in self.dates:
            buf.write(struct.pack('<i', self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_hash = reader.read_long()
        _args['hash'] = _val_hash
        reader.read_int(signed=False)  # skip vector id
        _count_packs = reader.read_int()
        _list_packs = []
        for _ in range(_count_packs):
            _item_packs = reader.tgread_object()
            _list_packs.append(_item_packs)
        _args['packs'] = _list_packs
        reader.read_int(signed=False)  # skip vector id
        _count_stickers = reader.read_int()
        _list_stickers = []
        for _ in range(_count_stickers):
            _item_stickers = reader.tgread_object()
            _list_stickers.append(_item_stickers)
        _args['stickers'] = _list_stickers
        reader.read_int(signed=False)  # skip vector id
        _count_dates = reader.read_int()
        _list_dates = []
        for _ in range(_count_dates):
            _item_dates = reader.read_int()
            _list_dates.append(_item_dates)
        _args['dates'] = _list_dates
        return cls(**_args)


class RecentStickersNotModified(TLObject):
    """TL type: messages.recentStickersNotModified"""
    CONSTRUCTOR_ID = 0x0b17f890
    SUBCLASS_OF_ID = 0xf76f8683

    def __init__(self):
        pass

    def to_dict(self):
        return {
            '_': 'RecentStickersNotModified',
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        return cls()


class SavedDialogs(TLObject):
    """TL type: messages.savedDialogs"""
    CONSTRUCTOR_ID = 0xf83ae221
    SUBCLASS_OF_ID = 0x614bb87e

    def __init__(self, dialogs: List['TypeSavedDialog'], messages: List['TypeMessage'], chats: List['TypeChat'], users: List['TypeUser']):
        self.dialogs = dialogs
        self.messages = messages
        self.chats = chats
        self.users = users

    def to_dict(self):
        return {
            '_': 'SavedDialogs',
            'dialogs': self.dialogs,
            'messages': self.messages,
            'chats': self.chats,
            'users': self.users,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.dialogs)))
        for item in self.dialogs:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.messages)))
        for item in self.messages:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.chats)))
        for item in self.chats:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.users)))
        for item in self.users:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        reader.read_int(signed=False)  # skip vector id
        _count_dialogs = reader.read_int()
        _list_dialogs = []
        for _ in range(_count_dialogs):
            _item_dialogs = reader.tgread_object()
            _list_dialogs.append(_item_dialogs)
        _args['dialogs'] = _list_dialogs
        reader.read_int(signed=False)  # skip vector id
        _count_messages = reader.read_int()
        _list_messages = []
        for _ in range(_count_messages):
            _item_messages = reader.tgread_object()
            _list_messages.append(_item_messages)
        _args['messages'] = _list_messages
        reader.read_int(signed=False)  # skip vector id
        _count_chats = reader.read_int()
        _list_chats = []
        for _ in range(_count_chats):
            _item_chats = reader.tgread_object()
            _list_chats.append(_item_chats)
        _args['chats'] = _list_chats
        reader.read_int(signed=False)  # skip vector id
        _count_users = reader.read_int()
        _list_users = []
        for _ in range(_count_users):
            _item_users = reader.tgread_object()
            _list_users.append(_item_users)
        _args['users'] = _list_users
        return cls(**_args)


class SavedDialogsNotModified(TLObject):
    """TL type: messages.savedDialogsNotModified"""
    CONSTRUCTOR_ID = 0xc01f6fe8
    SUBCLASS_OF_ID = 0x614bb87e

    def __init__(self, count: int):
        self.count = count

    def to_dict(self):
        return {
            '_': 'SavedDialogsNotModified',
            'count': self.count,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', self.count))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_count = reader.read_int()
        _args['count'] = _val_count
        return cls(**_args)


class SavedDialogsSlice(TLObject):
    """TL type: messages.savedDialogsSlice"""
    CONSTRUCTOR_ID = 0x44ba9dd9
    SUBCLASS_OF_ID = 0x614bb87e

    def __init__(self, count: int, dialogs: List['TypeSavedDialog'], messages: List['TypeMessage'], chats: List['TypeChat'], users: List['TypeUser']):
        self.count = count
        self.dialogs = dialogs
        self.messages = messages
        self.chats = chats
        self.users = users

    def to_dict(self):
        return {
            '_': 'SavedDialogsSlice',
            'count': self.count,
            'dialogs': self.dialogs,
            'messages': self.messages,
            'chats': self.chats,
            'users': self.users,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', self.count))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.dialogs)))
        for item in self.dialogs:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.messages)))
        for item in self.messages:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.chats)))
        for item in self.chats:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.users)))
        for item in self.users:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_count = reader.read_int()
        _args['count'] = _val_count
        reader.read_int(signed=False)  # skip vector id
        _count_dialogs = reader.read_int()
        _list_dialogs = []
        for _ in range(_count_dialogs):
            _item_dialogs = reader.tgread_object()
            _list_dialogs.append(_item_dialogs)
        _args['dialogs'] = _list_dialogs
        reader.read_int(signed=False)  # skip vector id
        _count_messages = reader.read_int()
        _list_messages = []
        for _ in range(_count_messages):
            _item_messages = reader.tgread_object()
            _list_messages.append(_item_messages)
        _args['messages'] = _list_messages
        reader.read_int(signed=False)  # skip vector id
        _count_chats = reader.read_int()
        _list_chats = []
        for _ in range(_count_chats):
            _item_chats = reader.tgread_object()
            _list_chats.append(_item_chats)
        _args['chats'] = _list_chats
        reader.read_int(signed=False)  # skip vector id
        _count_users = reader.read_int()
        _list_users = []
        for _ in range(_count_users):
            _item_users = reader.tgread_object()
            _list_users.append(_item_users)
        _args['users'] = _list_users
        return cls(**_args)


class SavedGifs(TLObject):
    """TL type: messages.savedGifs"""
    CONSTRUCTOR_ID = 0x84a02a0d
    SUBCLASS_OF_ID = 0xa68b61f5

    def __init__(self, hash: int, gifs: List['TypeDocument']):
        self.hash = hash
        self.gifs = gifs

    def to_dict(self):
        return {
            '_': 'SavedGifs',
            'hash': self.hash,
            'gifs': self.gifs,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<q', self.hash))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.gifs)))
        for item in self.gifs:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_hash = reader.read_long()
        _args['hash'] = _val_hash
        reader.read_int(signed=False)  # skip vector id
        _count_gifs = reader.read_int()
        _list_gifs = []
        for _ in range(_count_gifs):
            _item_gifs = reader.tgread_object()
            _list_gifs.append(_item_gifs)
        _args['gifs'] = _list_gifs
        return cls(**_args)


class SavedGifsNotModified(TLObject):
    """TL type: messages.savedGifsNotModified"""
    CONSTRUCTOR_ID = 0xe8025ca2
    SUBCLASS_OF_ID = 0xa68b61f5

    def __init__(self):
        pass

    def to_dict(self):
        return {
            '_': 'SavedGifsNotModified',
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        return cls()


class SavedReactionTags(TLObject):
    """TL type: messages.savedReactionTags"""
    CONSTRUCTOR_ID = 0x3259950a
    SUBCLASS_OF_ID = 0xa39b5be3

    def __init__(self, tags: List['TypeSavedReactionTag'], hash: int):
        self.tags = tags
        self.hash = hash

    def to_dict(self):
        return {
            '_': 'SavedReactionTags',
            'tags': self.tags,
            'hash': self.hash,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.tags)))
        for item in self.tags:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<q', self.hash))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        reader.read_int(signed=False)  # skip vector id
        _count_tags = reader.read_int()
        _list_tags = []
        for _ in range(_count_tags):
            _item_tags = reader.tgread_object()
            _list_tags.append(_item_tags)
        _args['tags'] = _list_tags
        _val_hash = reader.read_long()
        _args['hash'] = _val_hash
        return cls(**_args)


class SavedReactionTagsNotModified(TLObject):
    """TL type: messages.savedReactionTagsNotModified"""
    CONSTRUCTOR_ID = 0x889b59ef
    SUBCLASS_OF_ID = 0xa39b5be3

    def __init__(self):
        pass

    def to_dict(self):
        return {
            '_': 'SavedReactionTagsNotModified',
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        return cls()


class SearchCounter(TLObject):
    """TL type: messages.searchCounter"""
    CONSTRUCTOR_ID = 0xe844ebff
    SUBCLASS_OF_ID = 0xd6a7bfa2

    def __init__(self, filter: 'TypeMessagesFilter', count: int, inexact: Optional[bool] = None):
        self.filter = filter
        self.count = count
        self.inexact = inexact

    def to_dict(self):
        return {
            '_': 'SearchCounter',
            'filter': self.filter,
            'count': self.count,
            'inexact': self.inexact,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        flags = 0
        if self.inexact:
            flags |= (1 << 1)
        buf.write(struct.pack('<I', flags))
        buf.write(bytes(self.filter))
        buf.write(struct.pack('<i', self.count))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        flags = reader.read_int(signed=False)
        _args['inexact'] = bool(flags & (1 << 1))
        _val_filter = reader.tgread_object()
        _args['filter'] = _val_filter
        _val_count = reader.read_int()
        _args['count'] = _val_count
        return cls(**_args)


class SearchResultsCalendar(TLObject):
    """TL type: messages.searchResultsCalendar"""
    CONSTRUCTOR_ID = 0x147ee23c
    SUBCLASS_OF_ID = 0x92c5640f

    def __init__(self, count: int, min_date: Optional[datetime], min_msg_id: int, periods: List['TypeSearchResultsCalendarPeriod'], messages: List['TypeMessage'], chats: List['TypeChat'], users: List['TypeUser'], inexact: Optional[bool] = None, offset_id_offset: Optional[int] = None):
        self.count = count
        self.min_date = min_date
        self.min_msg_id = min_msg_id
        self.periods = periods
        self.messages = messages
        self.chats = chats
        self.users = users
        self.inexact = inexact
        self.offset_id_offset = offset_id_offset

    def to_dict(self):
        return {
            '_': 'SearchResultsCalendar',
            'count': self.count,
            'min_date': self.min_date,
            'min_msg_id': self.min_msg_id,
            'periods': self.periods,
            'messages': self.messages,
            'chats': self.chats,
            'users': self.users,
            'inexact': self.inexact,
            'offset_id_offset': self.offset_id_offset,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        flags = 0
        if self.inexact:
            flags |= (1 << 0)
        if self.offset_id_offset is not None:
            flags |= (1 << 1)
        buf.write(struct.pack('<I', flags))
        buf.write(struct.pack('<i', self.count))
        buf.write(struct.pack('<i', self.min_date))
        buf.write(struct.pack('<i', self.min_msg_id))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.periods)))
        for item in self.periods:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.messages)))
        for item in self.messages:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.chats)))
        for item in self.chats:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.users)))
        for item in self.users:
            buf.write(bytes(self.item))
        if self.offset_id_offset is not None:
            buf.write(struct.pack('<i', self.offset_id_offset))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        flags = reader.read_int(signed=False)
        _args['inexact'] = bool(flags & (1 << 0))
        _val_count = reader.read_int()
        _args['count'] = _val_count
        _val_min_date = reader.read_int()
        _args['min_date'] = _val_min_date
        _val_min_msg_id = reader.read_int()
        _args['min_msg_id'] = _val_min_msg_id
        if flags & (1 << 1):
            _val_offset_id_offset = reader.read_int()
            _args['offset_id_offset'] = _val_offset_id_offset
        else:
            _args['offset_id_offset'] = None
        reader.read_int(signed=False)  # skip vector id
        _count_periods = reader.read_int()
        _list_periods = []
        for _ in range(_count_periods):
            _item_periods = reader.tgread_object()
            _list_periods.append(_item_periods)
        _args['periods'] = _list_periods
        reader.read_int(signed=False)  # skip vector id
        _count_messages = reader.read_int()
        _list_messages = []
        for _ in range(_count_messages):
            _item_messages = reader.tgread_object()
            _list_messages.append(_item_messages)
        _args['messages'] = _list_messages
        reader.read_int(signed=False)  # skip vector id
        _count_chats = reader.read_int()
        _list_chats = []
        for _ in range(_count_chats):
            _item_chats = reader.tgread_object()
            _list_chats.append(_item_chats)
        _args['chats'] = _list_chats
        reader.read_int(signed=False)  # skip vector id
        _count_users = reader.read_int()
        _list_users = []
        for _ in range(_count_users):
            _item_users = reader.tgread_object()
            _list_users.append(_item_users)
        _args['users'] = _list_users
        return cls(**_args)


class SearchResultsPositions(TLObject):
    """TL type: messages.searchResultsPositions"""
    CONSTRUCTOR_ID = 0x53b22baf
    SUBCLASS_OF_ID = 0xd963708d

    def __init__(self, count: int, positions: List['TypeSearchResultsPosition']):
        self.count = count
        self.positions = positions

    def to_dict(self):
        return {
            '_': 'SearchResultsPositions',
            'count': self.count,
            'positions': self.positions,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', self.count))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.positions)))
        for item in self.positions:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_count = reader.read_int()
        _args['count'] = _val_count
        reader.read_int(signed=False)  # skip vector id
        _count_positions = reader.read_int()
        _list_positions = []
        for _ in range(_count_positions):
            _item_positions = reader.tgread_object()
            _list_positions.append(_item_positions)
        _args['positions'] = _list_positions
        return cls(**_args)


class SentEncryptedFile(TLObject):
    """TL type: messages.sentEncryptedFile"""
    CONSTRUCTOR_ID = 0x9493ff32
    SUBCLASS_OF_ID = 0xc99e3e50

    def __init__(self, date: Optional[datetime], file: 'TypeEncryptedFile'):
        self.date = date
        self.file = file

    def to_dict(self):
        return {
            '_': 'SentEncryptedFile',
            'date': self.date,
            'file': self.file,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', self.date))
        buf.write(bytes(self.file))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_date = reader.read_int()
        _args['date'] = _val_date
        _val_file = reader.tgread_object()
        _args['file'] = _val_file
        return cls(**_args)


class SentEncryptedMessage(TLObject):
    """TL type: messages.sentEncryptedMessage"""
    CONSTRUCTOR_ID = 0x560f8935
    SUBCLASS_OF_ID = 0xc99e3e50

    def __init__(self, date: Optional[datetime]):
        self.date = date

    def to_dict(self):
        return {
            '_': 'SentEncryptedMessage',
            'date': self.date,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', self.date))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_date = reader.read_int()
        _args['date'] = _val_date
        return cls(**_args)


class SponsoredMessages(TLObject):
    """TL type: messages.sponsoredMessages"""
    CONSTRUCTOR_ID = 0xffda656d
    SUBCLASS_OF_ID = 0x7f4169e0

    def __init__(self, messages: List['TypeSponsoredMessage'], chats: List['TypeChat'], users: List['TypeUser'], posts_between: Optional[int] = None, start_delay: Optional[int] = None, between_delay: Optional[int] = None):
        self.messages = messages
        self.chats = chats
        self.users = users
        self.posts_between = posts_between
        self.start_delay = start_delay
        self.between_delay = between_delay

    def to_dict(self):
        return {
            '_': 'SponsoredMessages',
            'messages': self.messages,
            'chats': self.chats,
            'users': self.users,
            'posts_between': self.posts_between,
            'start_delay': self.start_delay,
            'between_delay': self.between_delay,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        flags = 0
        if self.posts_between is not None:
            flags |= (1 << 0)
        if self.start_delay is not None:
            flags |= (1 << 1)
        if self.between_delay is not None:
            flags |= (1 << 2)
        buf.write(struct.pack('<I', flags))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.messages)))
        for item in self.messages:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.chats)))
        for item in self.chats:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.users)))
        for item in self.users:
            buf.write(bytes(self.item))
        if self.posts_between is not None:
            buf.write(struct.pack('<i', self.posts_between))
        if self.start_delay is not None:
            buf.write(struct.pack('<i', self.start_delay))
        if self.between_delay is not None:
            buf.write(struct.pack('<i', self.between_delay))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        flags = reader.read_int(signed=False)
        if flags & (1 << 0):
            _val_posts_between = reader.read_int()
            _args['posts_between'] = _val_posts_between
        else:
            _args['posts_between'] = None
        if flags & (1 << 1):
            _val_start_delay = reader.read_int()
            _args['start_delay'] = _val_start_delay
        else:
            _args['start_delay'] = None
        if flags & (1 << 2):
            _val_between_delay = reader.read_int()
            _args['between_delay'] = _val_between_delay
        else:
            _args['between_delay'] = None
        reader.read_int(signed=False)  # skip vector id
        _count_messages = reader.read_int()
        _list_messages = []
        for _ in range(_count_messages):
            _item_messages = reader.tgread_object()
            _list_messages.append(_item_messages)
        _args['messages'] = _list_messages
        reader.read_int(signed=False)  # skip vector id
        _count_chats = reader.read_int()
        _list_chats = []
        for _ in range(_count_chats):
            _item_chats = reader.tgread_object()
            _list_chats.append(_item_chats)
        _args['chats'] = _list_chats
        reader.read_int(signed=False)  # skip vector id
        _count_users = reader.read_int()
        _list_users = []
        for _ in range(_count_users):
            _item_users = reader.tgread_object()
            _list_users.append(_item_users)
        _args['users'] = _list_users
        return cls(**_args)


class SponsoredMessagesEmpty(TLObject):
    """TL type: messages.sponsoredMessagesEmpty"""
    CONSTRUCTOR_ID = 0x1839490f
    SUBCLASS_OF_ID = 0x7f4169e0

    def __init__(self):
        pass

    def to_dict(self):
        return {
            '_': 'SponsoredMessagesEmpty',
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        return cls()


class StickerSet(TLObject):
    """TL type: messages.stickerSet"""
    CONSTRUCTOR_ID = 0x6e153f16
    SUBCLASS_OF_ID = 0x9b704a5a

    def __init__(self, set: 'TypeStickerSet', packs: List['TypeStickerPack'], keywords: List['TypeStickerKeyword'], documents: List['TypeDocument']):
        self.set = set
        self.packs = packs
        self.keywords = keywords
        self.documents = documents

    def to_dict(self):
        return {
            '_': 'StickerSet',
            'set': self.set,
            'packs': self.packs,
            'keywords': self.keywords,
            'documents': self.documents,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(bytes(self.set))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.packs)))
        for item in self.packs:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.keywords)))
        for item in self.keywords:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.documents)))
        for item in self.documents:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_set = reader.tgread_object()
        _args['set'] = _val_set
        reader.read_int(signed=False)  # skip vector id
        _count_packs = reader.read_int()
        _list_packs = []
        for _ in range(_count_packs):
            _item_packs = reader.tgread_object()
            _list_packs.append(_item_packs)
        _args['packs'] = _list_packs
        reader.read_int(signed=False)  # skip vector id
        _count_keywords = reader.read_int()
        _list_keywords = []
        for _ in range(_count_keywords):
            _item_keywords = reader.tgread_object()
            _list_keywords.append(_item_keywords)
        _args['keywords'] = _list_keywords
        reader.read_int(signed=False)  # skip vector id
        _count_documents = reader.read_int()
        _list_documents = []
        for _ in range(_count_documents):
            _item_documents = reader.tgread_object()
            _list_documents.append(_item_documents)
        _args['documents'] = _list_documents
        return cls(**_args)


class StickerSetInstallResultArchive(TLObject):
    """TL type: messages.stickerSetInstallResultArchive"""
    CONSTRUCTOR_ID = 0x35e410a8
    SUBCLASS_OF_ID = 0x67cb3fe8

    def __init__(self, sets: List['TypeStickerSetCovered']):
        self.sets = sets

    def to_dict(self):
        return {
            '_': 'StickerSetInstallResultArchive',
            'sets': self.sets,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.sets)))
        for item in self.sets:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        reader.read_int(signed=False)  # skip vector id
        _count_sets = reader.read_int()
        _list_sets = []
        for _ in range(_count_sets):
            _item_sets = reader.tgread_object()
            _list_sets.append(_item_sets)
        _args['sets'] = _list_sets
        return cls(**_args)


class StickerSetInstallResultSuccess(TLObject):
    """TL type: messages.stickerSetInstallResultSuccess"""
    CONSTRUCTOR_ID = 0x38641628
    SUBCLASS_OF_ID = 0x67cb3fe8

    def __init__(self):
        pass

    def to_dict(self):
        return {
            '_': 'StickerSetInstallResultSuccess',
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        return cls()


class StickerSetNotModified(TLObject):
    """TL type: messages.stickerSetNotModified"""
    CONSTRUCTOR_ID = 0xd3f924eb
    SUBCLASS_OF_ID = 0x9b704a5a

    def __init__(self):
        pass

    def to_dict(self):
        return {
            '_': 'StickerSetNotModified',
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        return cls()


class Stickers(TLObject):
    """TL type: messages.stickers"""
    CONSTRUCTOR_ID = 0x30a6ec7e
    SUBCLASS_OF_ID = 0xd73bb9de

    def __init__(self, hash: int, stickers: List['TypeDocument']):
        self.hash = hash
        self.stickers = stickers

    def to_dict(self):
        return {
            '_': 'Stickers',
            'hash': self.hash,
            'stickers': self.stickers,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<q', self.hash))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.stickers)))
        for item in self.stickers:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_hash = reader.read_long()
        _args['hash'] = _val_hash
        reader.read_int(signed=False)  # skip vector id
        _count_stickers = reader.read_int()
        _list_stickers = []
        for _ in range(_count_stickers):
            _item_stickers = reader.tgread_object()
            _list_stickers.append(_item_stickers)
        _args['stickers'] = _list_stickers
        return cls(**_args)


class StickersNotModified(TLObject):
    """TL type: messages.stickersNotModified"""
    CONSTRUCTOR_ID = 0xf1749a22
    SUBCLASS_OF_ID = 0xd73bb9de

    def __init__(self):
        pass

    def to_dict(self):
        return {
            '_': 'StickersNotModified',
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        return cls()


class TranscribedAudio(TLObject):
    """TL type: messages.transcribedAudio"""
    CONSTRUCTOR_ID = 0xcfb9d957
    SUBCLASS_OF_ID = 0x21b24936

    def __init__(self, transcription_id: int, text: str, pending: Optional[bool] = None, trial_remains_num: Optional[int] = None, trial_remains_until_date: Optional[datetime] = None):
        self.transcription_id = transcription_id
        self.text = text
        self.pending = pending
        self.trial_remains_num = trial_remains_num
        self.trial_remains_until_date = trial_remains_until_date

    def to_dict(self):
        return {
            '_': 'TranscribedAudio',
            'transcription_id': self.transcription_id,
            'text': self.text,
            'pending': self.pending,
            'trial_remains_num': self.trial_remains_num,
            'trial_remains_until_date': self.trial_remains_until_date,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        flags = 0
        if self.pending:
            flags |= (1 << 0)
        if self.trial_remains_until_date is not None:
            flags |= (1 << 1)
        buf.write(struct.pack('<I', flags))
        buf.write(struct.pack('<q', self.transcription_id))
        buf.write(TLObject.serialize_bytes(self.text))
        if self.trial_remains_num is not None:
            buf.write(struct.pack('<i', self.trial_remains_num))
        if self.trial_remains_until_date is not None:
            buf.write(struct.pack('<i', self.trial_remains_until_date))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        flags = reader.read_int(signed=False)
        _args['pending'] = bool(flags & (1 << 0))
        _val_transcription_id = reader.read_long()
        _args['transcription_id'] = _val_transcription_id
        _val_text = reader.tgread_string()
        _args['text'] = _val_text
        if flags & (1 << 1):
            _val_trial_remains_num = reader.read_int()
            _args['trial_remains_num'] = _val_trial_remains_num
        else:
            _args['trial_remains_num'] = None
        if flags & (1 << 1):
            _val_trial_remains_until_date = reader.read_int()
            _args['trial_remains_until_date'] = _val_trial_remains_until_date
        else:
            _args['trial_remains_until_date'] = None
        return cls(**_args)


class TranslateResult(TLObject):
    """TL type: messages.translateResult"""
    CONSTRUCTOR_ID = 0x33db32f8
    SUBCLASS_OF_ID = 0x024243e8

    def __init__(self, result: List['TypeTextWithEntities']):
        self.result = result

    def to_dict(self):
        return {
            '_': 'TranslateResult',
            'result': self.result,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.result)))
        for item in self.result:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        reader.read_int(signed=False)  # skip vector id
        _count_result = reader.read_int()
        _list_result = []
        for _ in range(_count_result):
            _item_result = reader.tgread_object()
            _list_result.append(_item_result)
        _args['result'] = _list_result
        return cls(**_args)


class VotesList(TLObject):
    """TL type: messages.votesList"""
    CONSTRUCTOR_ID = 0x4899484e
    SUBCLASS_OF_ID = 0xc2199885

    def __init__(self, count: int, votes: List['TypeMessagePeerVote'], chats: List['TypeChat'], users: List['TypeUser'], next_offset: Optional[str] = None):
        self.count = count
        self.votes = votes
        self.chats = chats
        self.users = users
        self.next_offset = next_offset

    def to_dict(self):
        return {
            '_': 'VotesList',
            'count': self.count,
            'votes': self.votes,
            'chats': self.chats,
            'users': self.users,
            'next_offset': self.next_offset,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        flags = 0
        if self.next_offset is not None:
            flags |= (1 << 0)
        buf.write(struct.pack('<I', flags))
        buf.write(struct.pack('<i', self.count))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.votes)))
        for item in self.votes:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.chats)))
        for item in self.chats:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.users)))
        for item in self.users:
            buf.write(bytes(self.item))
        if self.next_offset is not None:
            buf.write(TLObject.serialize_bytes(self.next_offset))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        flags = reader.read_int(signed=False)
        _val_count = reader.read_int()
        _args['count'] = _val_count
        reader.read_int(signed=False)  # skip vector id
        _count_votes = reader.read_int()
        _list_votes = []
        for _ in range(_count_votes):
            _item_votes = reader.tgread_object()
            _list_votes.append(_item_votes)
        _args['votes'] = _list_votes
        reader.read_int(signed=False)  # skip vector id
        _count_chats = reader.read_int()
        _list_chats = []
        for _ in range(_count_chats):
            _item_chats = reader.tgread_object()
            _list_chats.append(_item_chats)
        _args['chats'] = _list_chats
        reader.read_int(signed=False)  # skip vector id
        _count_users = reader.read_int()
        _list_users = []
        for _ in range(_count_users):
            _item_users = reader.tgread_object()
            _list_users.append(_item_users)
        _args['users'] = _list_users
        if flags & (1 << 0):
            _val_next_offset = reader.tgread_string()
            _args['next_offset'] = _val_next_offset
        else:
            _args['next_offset'] = None
        return cls(**_args)


class WebPage(TLObject):
    """TL type: messages.webPage"""
    CONSTRUCTOR_ID = 0xfd5e12bd
    SUBCLASS_OF_ID = 0x2cf8b154

    def __init__(self, webpage: 'TypeWebPage', chats: List['TypeChat'], users: List['TypeUser']):
        self.webpage = webpage
        self.chats = chats
        self.users = users

    def to_dict(self):
        return {
            '_': 'WebPage',
            'webpage': self.webpage,
            'chats': self.chats,
            'users': self.users,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(bytes(self.webpage))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.chats)))
        for item in self.chats:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.users)))
        for item in self.users:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_webpage = reader.tgread_object()
        _args['webpage'] = _val_webpage
        reader.read_int(signed=False)  # skip vector id
        _count_chats = reader.read_int()
        _list_chats = []
        for _ in range(_count_chats):
            _item_chats = reader.tgread_object()
            _list_chats.append(_item_chats)
        _args['chats'] = _list_chats
        reader.read_int(signed=False)  # skip vector id
        _count_users = reader.read_int()
        _list_users = []
        for _ in range(_count_users):
            _item_users = reader.tgread_object()
            _list_users.append(_item_users)
        _args['users'] = _list_users
        return cls(**_args)


class WebPagePreview(TLObject):
    """TL type: messages.webPagePreview"""
    CONSTRUCTOR_ID = 0x8c9a88ac
    SUBCLASS_OF_ID = 0xe29410c2

    def __init__(self, media: 'TypeMessageMedia', chats: List['TypeChat'], users: List['TypeUser']):
        self.media = media
        self.chats = chats
        self.users = users

    def to_dict(self):
        return {
            '_': 'WebPagePreview',
            'media': self.media,
            'chats': self.chats,
            'users': self.users,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(bytes(self.media))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.chats)))
        for item in self.chats:
            buf.write(bytes(self.item))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.users)))
        for item in self.users:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_media = reader.tgread_object()
        _args['media'] = _val_media
        reader.read_int(signed=False)  # skip vector id
        _count_chats = reader.read_int()
        _list_chats = []
        for _ in range(_count_chats):
            _item_chats = reader.tgread_object()
            _list_chats.append(_item_chats)
        _args['chats'] = _list_chats
        reader.read_int(signed=False)  # skip vector id
        _count_users = reader.read_int()
        _list_users = []
        for _ in range(_count_users):
            _item_users = reader.tgread_object()
            _list_users.append(_item_users)
        _args['users'] = _list_users
        return cls(**_args)


class WebViewResult(TLObject):
    """TL type: messages.webViewResult"""
    CONSTRUCTOR_ID = 0xaadf159b
    SUBCLASS_OF_ID = 0xd8597669

    def __init__(self, result: 'TypeBotInlineResult', users: List['TypeUser']):
        self.result = result
        self.users = users

    def to_dict(self):
        return {
            '_': 'WebViewResult',
            'result': self.result,
            'users': self.users,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(bytes(self.result))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.users)))
        for item in self.users:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_result = reader.tgread_object()
        _args['result'] = _val_result
        reader.read_int(signed=False)  # skip vector id
        _count_users = reader.read_int()
        _list_users = []
        for _ in range(_count_users):
            _item_users = reader.tgread_object()
            _list_users.append(_item_users)
        _args['users'] = _list_users
        return cls(**_args)

