"""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 TypeChannelAdminLogEventsFilter, TypeChannelParticipantsFilter, TypeChatAdminRights, TypeChatBannedRights, TypeEmojiStatus, TypeInputChannel, TypeInputChatPhoto, TypeInputCheckPasswordSRP, TypeInputGeoPoint, TypeInputMessage, TypeInputPeer, TypeInputStickerSet, TypeInputUser class CheckUsernameRequest(TLRequest): CONSTRUCTOR_ID = 0x10e6bd2c SUBCLASS_OF_ID = 0xf5b399ac def __init__(self, channel: 'TypeInputChannel', username: str): """ :returns Bool: This type has no constructors. """ self.channel = channel self.username = username async def resolve(self, client, utils): self.channel = utils.get_input_channel(await client.get_input_entity(self.channel)) def to_dict(self): return { '_': 'CheckUsernameRequest', 'channel': self.channel.to_dict() if isinstance(self.channel, TLObject) else self.channel, 'username': self.username } def _bytes(self): return b''.join(( b',\xbd\xe6\x10', self.channel._bytes(), self.serialize_bytes(self.username), )) @classmethod def from_reader(cls, reader): _channel = reader.tgread_object() _username = reader.tgread_string() return cls(channel=_channel, username=_username) class ClickSponsoredMessageRequest(TLRequest): CONSTRUCTOR_ID = 0x18afbc93 SUBCLASS_OF_ID = 0xf5b399ac def __init__(self, channel: 'TypeInputChannel', random_id: bytes=None): """ :returns Bool: This type has no constructors. """ self.channel = channel self.random_id = random_id if random_id is not None else int.from_bytes(os.urandom(4), 'big', signed=True) async def resolve(self, client, utils): self.channel = utils.get_input_channel(await client.get_input_entity(self.channel)) def to_dict(self): return { '_': 'ClickSponsoredMessageRequest', 'channel': self.channel.to_dict() if isinstance(self.channel, TLObject) else self.channel, 'random_id': self.random_id } def _bytes(self): return b''.join(( b'\x93\xbc\xaf\x18', self.channel._bytes(), self.serialize_bytes(self.random_id), )) @classmethod def from_reader(cls, reader): _channel = reader.tgread_object() _random_id = reader.tgread_bytes() return cls(channel=_channel, random_id=_random_id) class ConvertToGigagroupRequest(TLRequest): CONSTRUCTOR_ID = 0xb290c69 SUBCLASS_OF_ID = 0x8af52aac def __init__(self, channel: 'TypeInputChannel'): """ :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage. """ self.channel = channel async def resolve(self, client, utils): self.channel = utils.get_input_channel(await client.get_input_entity(self.channel)) def to_dict(self): return { '_': 'ConvertToGigagroupRequest', 'channel': self.channel.to_dict() if isinstance(self.channel, TLObject) else self.channel } def _bytes(self): return b''.join(( b'i\x0c)\x0b', self.channel._bytes(), )) @classmethod def from_reader(cls, reader): _channel = reader.tgread_object() return cls(channel=_channel) class CreateChannelRequest(TLRequest): CONSTRUCTOR_ID = 0x91006707 SUBCLASS_OF_ID = 0x8af52aac def __init__(self, title: str, about: str, broadcast: Optional[bool]=None, megagroup: Optional[bool]=None, for_import: Optional[bool]=None, forum: Optional[bool]=None, geo_point: Optional['TypeInputGeoPoint']=None, address: Optional[str]=None, ttl_period: Optional[int]=None): """ :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage. """ self.title = title self.about = about self.broadcast = broadcast self.megagroup = megagroup self.for_import = for_import self.forum = forum self.geo_point = geo_point self.address = address self.ttl_period = ttl_period def to_dict(self): return { '_': 'CreateChannelRequest', 'title': self.title, 'about': self.about, 'broadcast': self.broadcast, 'megagroup': self.megagroup, 'for_import': self.for_import, 'forum': self.forum, 'geo_point': self.geo_point.to_dict() if isinstance(self.geo_point, TLObject) else self.geo_point, 'address': self.address, 'ttl_period': self.ttl_period } def _bytes(self): assert ((self.geo_point or self.geo_point is not None) and (self.address or self.address is not None)) or ((self.geo_point is None or self.geo_point is False) and (self.address is None or self.address is False)), 'geo_point, address parameters must all be False-y (like None) or all me True-y' return b''.join(( b'\x07g\x00\x91', struct.pack('