"""File generated by TLObjects' generator. All changes will be ERASED""" from ...tl.tlobject import TLObject from ...tl.tlobject import TLRequest from typing import Optional, List, Union, TYPE_CHECKING import os import struct from datetime import datetime if TYPE_CHECKING: from ...tl.types import TypeBotCommand, TypeBotCommandScope, TypeBotMenuButton, TypeChatAdminRights, TypeDataJSON, TypeEmojiStatus, TypeInputMedia, TypeInputPeer, TypeInputUser class AddPreviewMediaRequest(TLRequest): CONSTRUCTOR_ID = 0x17aeb75a SUBCLASS_OF_ID = 0x562abc2d def __init__(self, bot: 'TypeInputUser', lang_code: str, media: 'TypeInputMedia'): """ :returns BotPreviewMedia: Instance of BotPreviewMedia. """ self.bot = bot self.lang_code = lang_code self.media = media async def resolve(self, client, utils): self.bot = utils.get_input_user(await client.get_input_entity(self.bot)) self.media = utils.get_input_media(self.media) def to_dict(self): return { '_': 'AddPreviewMediaRequest', 'bot': self.bot.to_dict() if isinstance(self.bot, TLObject) else self.bot, 'lang_code': self.lang_code, 'media': self.media.to_dict() if isinstance(self.media, TLObject) else self.media } def _bytes(self): return b''.join(( b'Z\xb7\xae\x17', self.bot._bytes(), self.serialize_bytes(self.lang_code), self.media._bytes(), )) @classmethod def from_reader(cls, reader): _bot = reader.tgread_object() _lang_code = reader.tgread_string() _media = reader.tgread_object() return cls(bot=_bot, lang_code=_lang_code, media=_media) class AllowSendMessageRequest(TLRequest): CONSTRUCTOR_ID = 0xf132e3ef SUBCLASS_OF_ID = 0x8af52aac def __init__(self, bot: 'TypeInputUser'): """ :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage. """ self.bot = bot async def resolve(self, client, utils): self.bot = utils.get_input_user(await client.get_input_entity(self.bot)) def to_dict(self): return { '_': 'AllowSendMessageRequest', 'bot': self.bot.to_dict() if isinstance(self.bot, TLObject) else self.bot } def _bytes(self): return b''.join(( b'\xef\xe32\xf1', self.bot._bytes(), )) @classmethod def from_reader(cls, reader): _bot = reader.tgread_object() return cls(bot=_bot) class AnswerWebhookJSONQueryRequest(TLRequest): CONSTRUCTOR_ID = 0xe6213f4d SUBCLASS_OF_ID = 0xf5b399ac def __init__(self, query_id: int, data: 'TypeDataJSON'): """ :returns Bool: This type has no constructors. """ self.query_id = query_id self.data = data def to_dict(self): return { '_': 'AnswerWebhookJSONQueryRequest', 'query_id': self.query_id, 'data': self.data.to_dict() if isinstance(self.data, TLObject) else self.data } def _bytes(self): return b''.join(( b'M?!\xe6', struct.pack(': This type has no constructors. """ self.scope = scope self.lang_code = lang_code def to_dict(self): return { '_': 'GetBotCommandsRequest', 'scope': self.scope.to_dict() if isinstance(self.scope, TLObject) else self.scope, 'lang_code': self.lang_code } def _bytes(self): return b''.join(( b'\xd6\rL\xe3', self.scope._bytes(), self.serialize_bytes(self.lang_code), )) @classmethod def from_reader(cls, reader): _scope = reader.tgread_object() _lang_code = reader.tgread_string() return cls(scope=_scope, lang_code=_lang_code) class GetBotInfoRequest(TLRequest): CONSTRUCTOR_ID = 0xdcd914fd SUBCLASS_OF_ID = 0xca7b2235 def __init__(self, lang_code: str, bot: Optional['TypeInputUser']=None): """ :returns bots.BotInfo: Instance of BotInfo. """ self.lang_code = lang_code self.bot = bot async def resolve(self, client, utils): if self.bot: self.bot = utils.get_input_user(await client.get_input_entity(self.bot)) def to_dict(self): return { '_': 'GetBotInfoRequest', 'lang_code': self.lang_code, 'bot': self.bot.to_dict() if isinstance(self.bot, TLObject) else self.bot } def _bytes(self): return b''.join(( b'\xfd\x14\xd9\xdc', struct.pack(': This type has no constructors. """ self.bot = bot async def resolve(self, client, utils): self.bot = utils.get_input_user(await client.get_input_entity(self.bot)) def to_dict(self): return { '_': 'GetPreviewMediasRequest', 'bot': self.bot.to_dict() if isinstance(self.bot, TLObject) else self.bot } def _bytes(self): return b''.join(( b'MY\xa5\xa2', self.bot._bytes(), )) @classmethod def from_reader(cls, reader): _bot = reader.tgread_object() return cls(bot=_bot) class InvokeWebViewCustomMethodRequest(TLRequest): CONSTRUCTOR_ID = 0x87fc5e7 SUBCLASS_OF_ID = 0xad0352e8 def __init__(self, bot: 'TypeInputUser', custom_method: str, params: 'TypeDataJSON'): """ :returns DataJSON: Instance of DataJSON. """ self.bot = bot self.custom_method = custom_method self.params = params async def resolve(self, client, utils): self.bot = utils.get_input_user(await client.get_input_entity(self.bot)) def to_dict(self): return { '_': 'InvokeWebViewCustomMethodRequest', 'bot': self.bot.to_dict() if isinstance(self.bot, TLObject) else self.bot, 'custom_method': self.custom_method, 'params': self.params.to_dict() if isinstance(self.params, TLObject) else self.params } def _bytes(self): return b''.join(( b'\xe7\xc5\x7f\x08', self.bot._bytes(), self.serialize_bytes(self.custom_method), self.params._bytes(), )) @classmethod def from_reader(cls, reader): _bot = reader.tgread_object() _custom_method = reader.tgread_string() _params = reader.tgread_object() return cls(bot=_bot, custom_method=_custom_method, params=_params) class ReorderPreviewMediasRequest(TLRequest): CONSTRUCTOR_ID = 0xb627f3aa SUBCLASS_OF_ID = 0xf5b399ac def __init__(self, bot: 'TypeInputUser', lang_code: str, order: List['TypeInputMedia']): """ :returns Bool: This type has no constructors. """ self.bot = bot self.lang_code = lang_code self.order = order async def resolve(self, client, utils): self.bot = utils.get_input_user(await client.get_input_entity(self.bot)) _tmp = [] for _x in self.order: _tmp.append(utils.get_input_media(_x)) self.order = _tmp def to_dict(self): return { '_': 'ReorderPreviewMediasRequest', 'bot': self.bot.to_dict() if isinstance(self.bot, TLObject) else self.bot, 'lang_code': self.lang_code, 'order': [] if self.order is None else [x.to_dict() if isinstance(x, TLObject) else x for x in self.order] } def _bytes(self): return b''.join(( b"\xaa\xf3'\xb6", self.bot._bytes(), self.serialize_bytes(self.lang_code), b'\x15\xc4\xb5\x1c',struct.pack('