diff --git a/docs/res/js/search.js b/docs/res/js/search.js index c63672e7..1b33980b 100644 --- a/docs/res/js/search.js +++ b/docs/res/js/search.js @@ -147,6 +147,7 @@ function updateSearch() { } else { exactMatch.style.display = ""; buildList(null, exactList, [destination, destinationu]); + return destinationu[0]; } } else { contentDiv.style.display = ""; @@ -169,4 +170,8 @@ if (query) { searchBox.value = query; } -updateSearch(); +var exactUrl = updateSearch(); +var redirect = getQuery('redirect'); +if (exactUrl && redirect != 'no') { + window.location = exactUrl; +} diff --git a/telethon/errors/rpc_error_list.py b/telethon/errors/rpc_error_list.py new file mode 100644 index 00000000..530ed732 --- /dev/null +++ b/telethon/errors/rpc_error_list.py @@ -0,0 +1,1422 @@ +from .rpc_base_errors import RPCError, BadMessageError, InvalidDCError, BadRequestError, UnauthorizedError, ForbiddenError, NotFoundError, FloodError, ServerError + + +class RPCErrorNeg503(RPCError): + code = -503 + + +class FloodTestPhoneWaitError(FloodError): + def __init__(self, **kwargs): + self.seconds = int(kwargs.get('capture', 0)) + super(Exception, self).__init__('A wait of {} seconds is required in the test servers'.format(self.seconds)) + + +class FloodWaitError(FloodError): + def __init__(self, **kwargs): + self.seconds = int(kwargs.get('capture', 0)) + super(Exception, self).__init__('A wait of {} seconds is required'.format(self.seconds)) + + +class ActiveUserRequiredError(UnauthorizedError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The method is only available to already activated users') + + +class AuthKeyInvalidError(UnauthorizedError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The key is invalid') + + +class AuthKeyPermEmptyError(UnauthorizedError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The method is unavailable for temporary authorization key, not bound to permanent') + + +class AuthKeyUnregisteredError(UnauthorizedError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The key is not registered in the system') + + +class SessionExpiredError(UnauthorizedError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The authorization has expired') + + +class SessionPasswordNeededError(UnauthorizedError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Two-steps verification is enabled and a password is required') + + +class SessionRevokedError(UnauthorizedError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The authorization has been invalidated, because of the user terminating all sessions') + + +class UserDeactivatedError(UnauthorizedError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The user has been deleted/deactivated') + + +class FileMigrateError(InvalidDCError): + def __init__(self, **kwargs): + self.new_dc = int(kwargs.get('capture', 0)) + super(Exception, self).__init__('The file to be accessed is currently stored in DC {}'.format(self.new_dc)) + + +class NetworkMigrateError(InvalidDCError): + def __init__(self, **kwargs): + self.new_dc = int(kwargs.get('capture', 0)) + super(Exception, self).__init__('The source IP address is associated with DC {}'.format(self.new_dc)) + + +class PhoneMigrateError(InvalidDCError): + def __init__(self, **kwargs): + self.new_dc = int(kwargs.get('capture', 0)) + super(Exception, self).__init__('The phone number a user is trying to use for authorization is associated with DC {}'.format(self.new_dc)) + + +class UserMigrateError(InvalidDCError): + def __init__(self, **kwargs): + self.new_dc = int(kwargs.get('capture', 0)) + super(Exception, self).__init__('The user whose identity is being used to execute queries is associated with DC {}'.format(self.new_dc)) + + +class TimeoutError(RPCErrorNeg503): + def __init__(self, **kwargs): + super(Exception, self).__init__('No description known.') + + +class AboutTooLongError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The provided bio is too long') + + +class AccessTokenExpiredError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Bot token expired') + + +class AccessTokenInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The provided token is not valid') + + +class AdminsTooMuchError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Too many admins') + + +class ApiIdInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The api_id/api_hash combination is invalid') + + +class ApiIdPublishedFloodError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__("This API id was published somewhere, you can't use it now") + + +class ArticleTitleEmptyError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The title of the article is empty') + + +class AuthBytesInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The provided authorization is invalid') + + +class BotsTooMuchError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('There are too many bots in this chat/channel') + + +class BotChannelsNaError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__("Bots can't edit admin privileges") + + +class BotGroupsBlockedError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__("This bot can't be added to groups") + + +class BotInlineDisabledError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__("This bot can't be used in inline mode") + + +class BotInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('This is not a valid bot') + + +class BotMethodInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The API access for bot users is restricted. The method you tried to invoke cannot be executed as a bot') + + +class BotMissingError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('This method can only be run by a bot') + + +class ButtonDataInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The provided button data is invalid') + + +class ButtonTypeInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The type of one of the buttons you provided is invalid') + + +class ButtonUrlInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Button URL invalid') + + +class CallAlreadyAcceptedError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The call was already accepted') + + +class CallAlreadyDeclinedError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The call was already declined') + + +class CallPeerInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The provided call peer object is invalid') + + +class CallProtocolFlagsInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Call protocol flags invalid') + + +class CdnMethodInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('This method cannot be invoked on a CDN server. Refer to https://core.telegram.org/cdn#schema for available methods') + + +class ChannelsAdminPublicTooMuchError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__("You're admin of too many public channels, make some channels private to change the username of this channel") + + +class ChannelsTooMuchError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('You have joined too many channels/supergroups') + + +class ChannelInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Invalid channel object. Make sure to pass the right types, for instance making sure that the request is designed for channels or otherwise look for a different one more suited') + + +class ChannelPrivateError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The channel specified is private and you lack permission to access it. Another reason may be that you were banned from it') + + +class ChatAboutNotModifiedError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('About text has not changed') + + +class ChatAboutTooLongError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Chat about too long') + + +class ChatAdminRequiredError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Chat admin privileges are required to do that in the specified chat (for example, to send a message in a channel which is not yours)') + + +class ChatForbiddenError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('You cannot write in this chat') + + +class ChatIdEmptyError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The provided chat ID is empty') + + +class ChatIdInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Invalid object ID for a chat. Make sure to pass the right types, for instance making sure that the request is designed for chats (not channels/megagroups) or otherwise look for a different one more suited\\nAn example working with a megagroup and AddChatUserRequest, it will fail because megagroups are channels. Use InviteToChannelRequest instead') + + +class ChatNotModifiedError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__("The pinned message wasn't modified") + + +class ChatTitleEmptyError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('No chat title provided') + + +class CodeEmptyError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The provided code is empty') + + +class CodeHashInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Code hash invalid') + + +class ConnectionApiIdInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The provided API id is invalid') + + +class ConnectionDeviceModelEmptyError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Device model empty') + + +class ConnectionLangPackInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The specified language pack is not valid. This is meant to be used by official applications only so far, leave it empty') + + +class ConnectionLayerInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The very first request must always be InvokeWithLayerRequest') + + +class ConnectionNotInitedError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Connection not initialized') + + +class ConnectionSystemEmptyError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Connection system empty') + + +class ContactIdInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The provided contact ID is invalid') + + +class DataInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Encrypted data invalid') + + +class DataJsonInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The provided JSON data is invalid') + + +class DateEmptyError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Date empty') + + +class DcIdInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('This occurs when an authorization is tried to be exported for the same data center one is currently connected to') + + +class DhGAInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('g_a invalid') + + +class EmailUnconfirmedError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Email unconfirmed') + + +class EncryptedMessageInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Encrypted message invalid') + + +class EncryptionAlreadyAcceptedError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Secret chat already accepted') + + +class EncryptionAlreadyDeclinedError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The secret chat was already declined') + + +class EncryptionDeclinedError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The secret chat was declined') + + +class EncryptionIdInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The provided secret chat ID is invalid') + + +class EntityMentionUserInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__("You can't use this entity") + + +class ErrorTextEmptyError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The provided error message is empty') + + +class ExportCardInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Provided card is invalid') + + +class ExternalUrlInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('External URL invalid') + + +class FieldNameEmptyError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The field with the name FIELD_NAME is missing') + + +class FieldNameInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The field with the name FIELD_NAME is invalid') + + +class FileIdInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The provided file id is invalid') + + +class FilePartsInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The number of file parts is invalid') + + +class FilePartEmptyError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The provided file part is empty') + + +class FilePartInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The file part number is invalid') + + +class FilePartLengthInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The length of a file part is invalid') + + +class FilePartSizeInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The provided file part size is invalid') + + +class FilePartMissingError(BadRequestError): + def __init__(self, **kwargs): + self.which = int(kwargs.get('capture', 0)) + super(Exception, self).__init__('Part {} of the file is missing from storage'.format(self.which)) + + +class FirstNameInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The first name is invalid') + + +class GifIdInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The provided GIF ID is invalid') + + +class GroupedMediaInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Invalid grouped media') + + +class HashInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The provided hash is invalid') + + +class ImageProcessFailedError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Failure while processing image') + + +class InlineResultExpiredError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The inline query expired') + + +class InputConstructorInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The provided constructor is invalid') + + +class InputFetchErrorError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('An error occurred while deserializing TL parameters') + + +class InputFetchFailError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Failed deserializing TL payload') + + +class InputLayerInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The provided layer is invalid') + + +class InputMethodInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The invoked method does not exist anymore or has never existed') + + +class InputRequestTooLongError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The input request was too long. This may be a bug in the library as it can occur when serializing more bytes than it should (likeappending the vector constructor code at the end of a message)') + + +class InputUserDeactivatedError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The specified user was deleted') + + +class InterdcCallErrorError(BadRequestError): + def __init__(self, **kwargs): + self.x = int(kwargs.get('capture', 0)) + super(Exception, self).__init__('No description known.'.format(self.x)) + + +class InterdcCallRichErrorError(BadRequestError): + def __init__(self, **kwargs): + self.x = int(kwargs.get('capture', 0)) + super(Exception, self).__init__('No description known.'.format(self.x)) + + +class InviteHashEmptyError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The invite hash is empty') + + +class InviteHashExpiredError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The chat the user tried to join has expired and is not valid anymore') + + +class InviteHashInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The invite hash is invalid') + + +class LangPackInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The provided language pack is invalid') + + +class LastnameInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The last name is invalid') + + +class LimitInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('An invalid limit was provided. See https://core.telegram.org/api/files#downloading-files') + + +class LocationInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The location given for a file was invalid. See https://core.telegram.org/api/files#downloading-files') + + +class MaxIdInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The provided max ID is invalid') + + +class Md5ChecksumInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The MD5 check-sums do not match') + + +class MediaCaptionTooLongError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The caption is too long') + + +class MediaEmptyError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The provided media object is invalid') + + +class MediaInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Media invalid') + + +class MessageEditTimeExpiredError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__("You can't edit this message anymore, too much time has passed since its creation.") + + +class MessageEmptyError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Empty or invalid UTF-8 message was sent') + + +class MessageIdsEmptyError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('No message ids were provided') + + +class MessageIdInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The specified message ID is invalid') + + +class MessageNotModifiedError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Content of the message was not modified') + + +class MessageTooLongError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Message was too long. Current maximum length is 4096 UTF-8 characters') + + +class MsgWaitFailedError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('A waiting call returned an error') + + +class NewSaltInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The new salt is invalid') + + +class NewSettingsInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The new settings are invalid') + + +class OffsetInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The given offset was invalid, it must be divisible by 1KB. See https://core.telegram.org/api/files#downloading-files') + + +class OffsetPeerIdInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The provided offset peer is invalid') + + +class PackShortNameInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Short pack name invalid') + + +class PackShortNameOccupiedError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('A stickerpack with this name already exists') + + +class ParticipantsTooFewError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Not enough participants') + + +class ParticipantVersionOutdatedError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The other participant does not use an up to date telegram client with support for calls') + + +class PasswordEmptyError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The provided password is empty') + + +class PasswordHashInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The password (and thus its hash value) you entered is invalid') + + +class PeerFloodError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Too many requests') + + +class PeerIdInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('An invalid Peer was used. Make sure to pass the right peer type') + + +class PeerIdNotSupportedError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The provided peer ID is not supported') + + +class PersistentTimestampEmptyError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Persistent timestamp empty') + + +class PersistentTimestampInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Persistent timestamp invalid') + + +class PhoneCodeEmptyError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The phone code is missing') + + +class PhoneCodeExpiredError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The confirmation code has expired') + + +class PhoneCodeHashEmptyError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The phone code hash is missing') + + +class PhoneCodeInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The phone code entered was invalid') + + +class PhoneNumberAppSignupForbiddenError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('') + + +class PhoneNumberBannedError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The used phone number has been banned from Telegram and cannot be used anymore. Maybe check https://www.telegram.org/faq_spam') + + +class PhoneNumberFloodError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('You asked for the code too many times.') + + +class PhoneNumberInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The phone number is invalid') + + +class PhoneNumberOccupiedError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The phone number is already in use') + + +class PhoneNumberUnoccupiedError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The phone number is not yet being used') + + +class PhonePasswordFloodError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('You have tried logging in too many times') + + +class PhonePasswordProtectedError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('This phone is password protected') + + +class PhotoCropSizeSmallError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Photo is too small') + + +class PhotoExtInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The extension of the photo is invalid') + + +class PhotoInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Photo invalid') + + +class PhotoInvalidDimensionsError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The photo dimensions are invalid') + + +class PrivacyKeyInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The privacy key is invalid') + + +class QueryIdEmptyError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The query ID is empty') + + +class QueryIdInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The query ID is invalid') + + +class QueryTooShortError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The query string is too short') + + +class RandomIdInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('A provided random ID is invalid') + + +class RandomLengthInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Random length invalid') + + +class RangesInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Invalid range provided') + + +class ReplyMarkupInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The provided reply markup is invalid') + + +class ResultTypeInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Result type invalid') + + +class RpcCallFailError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Telegram is having internal issues, please try again later.') + + +class RpcMcgetFailError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Telegram is having internal issues, please try again later.') + + +class RsaDecryptFailedError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Internal RSA decryption failed') + + +class SearchQueryEmptyError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The search query is empty') + + +class SendMessageTypeInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The message type is invalid') + + +class Sha256HashInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The provided SHA256 hash is invalid') + + +class StartParamEmptyError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The start parameter is empty') + + +class StartParamInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Start parameter invalid') + + +class StickersetInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The provided sticker set is invalid') + + +class StickersEmptyError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('No sticker provided') + + +class StickerEmojiInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Sticker emoji invalid') + + +class StickerFileInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Sticker file invalid') + + +class StickerIdInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The provided sticker ID is invalid') + + +class StickerInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The provided sticker is invalid') + + +class StickerPngDimensionsError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Sticker png dimensions invalid') + + +class TempAuthKeyEmptyError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('No temporary auth key provided') + + +class TmpPasswordDisabledError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The temporary password is disabled') + + +class TokenInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The provided token is invalid') + + +class TtlDaysInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The provided TTL is invalid') + + +class TypesEmptyError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The types field is empty') + + +class TypeConstructorInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The type constructor is invalid') + + +class UsernameInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Nobody is using this username, or the username is unacceptable. If the latter, it must match r"[a-zA-Z][\\w\\d]{3,30}[a-zA-Z\\d]"') + + +class UsernameNotModifiedError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The username is not different from the current username') + + +class UsernameNotOccupiedError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The username is not in use by anyone else yet') + + +class UsernameOccupiedError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The username is already taken') + + +class UsersTooFewError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Not enough users (to create a chat, for example)') + + +class UsersTooMuchError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The maximum number of users has been exceeded (to create a chat, for example)') + + +class UserAdminInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__("You're not an admin") + + +class UserAlreadyParticipantError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The authenticated user is already a participant of the chat') + + +class UserBannedInChannelError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__("You're banned from sending messages in supergroups/channels") + + +class UserBlockedError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('User blocked') + + +class UserBotError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Bots can only be admins in channels.') + + +class UserBotInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('This method can only be called by a bot') + + +class UserBotRequiredError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('This method can only be called by a bot') + + +class UserCreatorError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__("You can't leave this channel, because you're its creator") + + +class UserIdInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Invalid object ID for an user. Make sure to pass the right types, for instance making sure that the request is designed for users or otherwise look for a different one more suited') + + +class UserIsBlockedError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('User is blocked') + + +class UserIsBotError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__("Bots can't send messages to other bots") + + +class UserKickedError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('This user was kicked from this supergroup/channel') + + +class UserNotMutualContactError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The provided user is not a mutual contact') + + +class UserNotParticipantError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__("You're not a member of this supergroup/channel") + + +class WcConvertUrlInvalidError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('WC convert URL invalid') + + +class WebpageCurlFailedError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Failure while fetching the webpage with cURL') + + +class WebpageMediaEmptyError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Webpage media empty') + + +class YouBlockedUserError(BadRequestError): + def __init__(self, **kwargs): + super(Exception, self).__init__('You blocked this user') + + +class ChannelPublicGroupNaError(ForbiddenError): + def __init__(self, **kwargs): + super(Exception, self).__init__('channel/supergroup not available') + + +class ChatAdminInviteRequiredError(ForbiddenError): + def __init__(self, **kwargs): + super(Exception, self).__init__('You do not have the rights to do this') + + +class ChatAdminRequiredError(ForbiddenError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Chat admin privileges are required to do that in the specified chat (for example, to send a message in a channel which is not yours)') + + +class ChatSendGifsForbiddenError(ForbiddenError): + def __init__(self, **kwargs): + super(Exception, self).__init__("You can't send gifs in this chat") + + +class ChatSendMediaForbiddenError(ForbiddenError): + def __init__(self, **kwargs): + super(Exception, self).__init__("You can't send media in this chat") + + +class ChatSendStickersForbiddenError(ForbiddenError): + def __init__(self, **kwargs): + super(Exception, self).__init__("You can't send stickers in this chat.") + + +class ChatWriteForbiddenError(ForbiddenError): + def __init__(self, **kwargs): + super(Exception, self).__init__("You can't write in this chat") + + +class MessageAuthorRequiredError(ForbiddenError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Message author required') + + +class MessageDeleteForbiddenError(ForbiddenError): + def __init__(self, **kwargs): + super(Exception, self).__init__("You can't delete one of the messages you tried to delete, most likely because it is a service message.") + + +class RightForbiddenError(ForbiddenError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Your admin rights do not allow you to do this') + + +class UserBotInvalidError(ForbiddenError): + def __init__(self, **kwargs): + super(Exception, self).__init__('This method can only be called by a bot') + + +class UserChannelsTooMuchError(ForbiddenError): + def __init__(self, **kwargs): + super(Exception, self).__init__('One of the users you tried to add is already in too many channels/supergroups') + + +class UserIsBlockedError(ForbiddenError): + def __init__(self, **kwargs): + super(Exception, self).__init__('User is blocked') + + +class UserNotMutualContactError(ForbiddenError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The provided user is not a mutual contact') + + +class UserPrivacyRestrictedError(ForbiddenError): + def __init__(self, **kwargs): + super(Exception, self).__init__("The user's privacy settings do not allow you to do this") + + +class UserRestrictedError(ForbiddenError): + def __init__(self, **kwargs): + super(Exception, self).__init__("You're spamreported, you can't create channels or chats.") + + +class AuthRestartError(ServerError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Restart the authorization process') + + +class CallOccupyFailedError(ServerError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The call failed because the user is already making another call') + + +class EncryptionOccupyFailedError(ServerError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Internal server error while accepting secret chat') + + +class HistoryGetFailedError(ServerError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Fetching of history failed') + + +class MemberNoLocationError(ServerError): + def __init__(self, **kwargs): + super(Exception, self).__init__("An internal failure occurred while fetching user info (couldn't find location)") + + +class MemberOccupyPrimaryLocFailedError(ServerError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Occupation of primary member location failed') + + +class NeedChatInvalidError(ServerError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The provided chat is invalid') + + +class NeedMemberInvalidError(ServerError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The provided member is invalid') + + +class ParticipantCallFailedError(ServerError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Failure while making call') + + +class PersistentTimestampOutdatedError(ServerError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Persistent timestamp outdated') + + +class PtsChangeEmptyError(ServerError): + def __init__(self, **kwargs): + super(Exception, self).__init__('No PTS change') + + +class RandomIdDuplicateError(ServerError): + def __init__(self, **kwargs): + super(Exception, self).__init__('You provided a random ID that was already used') + + +class RegIdGenerateFailedError(ServerError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Failure while generating registration ID') + + +class StorageCheckFailedError(ServerError): + def __init__(self, **kwargs): + super(Exception, self).__init__('Server storage check failed') + + +class StoreInvalidScalarTypeError(ServerError): + def __init__(self, **kwargs): + super(Exception, self).__init__('') + + +class UnknownMethodError(ServerError): + def __init__(self, **kwargs): + super(Exception, self).__init__('The method you tried to call cannot be called on non-CDN DCs') + + +rpc_errors_all = { + 'FLOOD_TEST_PHONE_WAIT_(\\d+)': FloodTestPhoneWaitError, + 'FLOOD_WAIT_(\\d+)': FloodWaitError, + 'ACTIVE_USER_REQUIRED': ActiveUserRequiredError, + 'AUTH_KEY_INVALID': AuthKeyInvalidError, + 'AUTH_KEY_PERM_EMPTY': AuthKeyPermEmptyError, + 'AUTH_KEY_UNREGISTERED': AuthKeyUnregisteredError, + 'SESSION_EXPIRED': SessionExpiredError, + 'SESSION_PASSWORD_NEEDED': SessionPasswordNeededError, + 'SESSION_REVOKED': SessionRevokedError, + 'USER_DEACTIVATED': UserDeactivatedError, + 'FILE_MIGRATE_(\\d+)': FileMigrateError, + 'NETWORK_MIGRATE_(\\d+)': NetworkMigrateError, + 'PHONE_MIGRATE_(\\d+)': PhoneMigrateError, + 'USER_MIGRATE_(\\d+)': UserMigrateError, + 'TIMEOUT': TimeoutError, + 'ABOUT_TOO_LONG': AboutTooLongError, + 'ACCESS_TOKEN_EXPIRED': AccessTokenExpiredError, + 'ACCESS_TOKEN_INVALID': AccessTokenInvalidError, + 'ADMINS_TOO_MUCH': AdminsTooMuchError, + 'API_ID_INVALID': ApiIdInvalidError, + 'API_ID_PUBLISHED_FLOOD': ApiIdPublishedFloodError, + 'ARTICLE_TITLE_EMPTY': ArticleTitleEmptyError, + 'AUTH_BYTES_INVALID': AuthBytesInvalidError, + 'BOTS_TOO_MUCH': BotsTooMuchError, + 'BOT_CHANNELS_NA': BotChannelsNaError, + 'BOT_GROUPS_BLOCKED': BotGroupsBlockedError, + 'BOT_INLINE_DISABLED': BotInlineDisabledError, + 'BOT_INVALID': BotInvalidError, + 'BOT_METHOD_INVALID': BotMethodInvalidError, + 'BOT_MISSING': BotMissingError, + 'BUTTON_DATA_INVALID': ButtonDataInvalidError, + 'BUTTON_TYPE_INVALID': ButtonTypeInvalidError, + 'BUTTON_URL_INVALID': ButtonUrlInvalidError, + 'CALL_ALREADY_ACCEPTED': CallAlreadyAcceptedError, + 'CALL_ALREADY_DECLINED': CallAlreadyDeclinedError, + 'CALL_PEER_INVALID': CallPeerInvalidError, + 'CALL_PROTOCOL_FLAGS_INVALID': CallProtocolFlagsInvalidError, + 'CDN_METHOD_INVALID': CdnMethodInvalidError, + 'CHANNELS_ADMIN_PUBLIC_TOO_MUCH': ChannelsAdminPublicTooMuchError, + 'CHANNELS_TOO_MUCH': ChannelsTooMuchError, + 'CHANNEL_INVALID': ChannelInvalidError, + 'CHANNEL_PRIVATE': ChannelPrivateError, + 'CHAT_ABOUT_NOT_MODIFIED': ChatAboutNotModifiedError, + 'CHAT_ABOUT_TOO_LONG': ChatAboutTooLongError, + 'CHAT_ADMIN_REQUIRED': ChatAdminRequiredError, + 'CHAT_FORBIDDEN': ChatForbiddenError, + 'CHAT_ID_EMPTY': ChatIdEmptyError, + 'CHAT_ID_INVALID': ChatIdInvalidError, + 'CHAT_NOT_MODIFIED': ChatNotModifiedError, + 'CHAT_TITLE_EMPTY': ChatTitleEmptyError, + 'CODE_EMPTY': CodeEmptyError, + 'CODE_HASH_INVALID': CodeHashInvalidError, + 'CONNECTION_API_ID_INVALID': ConnectionApiIdInvalidError, + 'CONNECTION_DEVICE_MODEL_EMPTY': ConnectionDeviceModelEmptyError, + 'CONNECTION_LANG_PACK_INVALID': ConnectionLangPackInvalidError, + 'CONNECTION_LAYER_INVALID': ConnectionLayerInvalidError, + 'CONNECTION_NOT_INITED': ConnectionNotInitedError, + 'CONNECTION_SYSTEM_EMPTY': ConnectionSystemEmptyError, + 'CONTACT_ID_INVALID': ContactIdInvalidError, + 'DATA_INVALID': DataInvalidError, + 'DATA_JSON_INVALID': DataJsonInvalidError, + 'DATE_EMPTY': DateEmptyError, + 'DC_ID_INVALID': DcIdInvalidError, + 'DH_G_A_INVALID': DhGAInvalidError, + 'EMAIL_UNCONFIRMED': EmailUnconfirmedError, + 'ENCRYPTED_MESSAGE_INVALID': EncryptedMessageInvalidError, + 'ENCRYPTION_ALREADY_ACCEPTED': EncryptionAlreadyAcceptedError, + 'ENCRYPTION_ALREADY_DECLINED': EncryptionAlreadyDeclinedError, + 'ENCRYPTION_DECLINED': EncryptionDeclinedError, + 'ENCRYPTION_ID_INVALID': EncryptionIdInvalidError, + 'ENTITY_MENTION_USER_INVALID': EntityMentionUserInvalidError, + 'ERROR_TEXT_EMPTY': ErrorTextEmptyError, + 'EXPORT_CARD_INVALID': ExportCardInvalidError, + 'EXTERNAL_URL_INVALID': ExternalUrlInvalidError, + 'FIELD_NAME_EMPTY': FieldNameEmptyError, + 'FIELD_NAME_INVALID': FieldNameInvalidError, + 'FILE_ID_INVALID': FileIdInvalidError, + 'FILE_PARTS_INVALID': FilePartsInvalidError, + 'FILE_PART_EMPTY': FilePartEmptyError, + 'FILE_PART_INVALID': FilePartInvalidError, + 'FILE_PART_LENGTH_INVALID': FilePartLengthInvalidError, + 'FILE_PART_SIZE_INVALID': FilePartSizeInvalidError, + 'FILE_PART_(\\d+)_MISSING': FilePartMissingError, + 'FIRSTNAME_INVALID': FirstNameInvalidError, + 'GIF_ID_INVALID': GifIdInvalidError, + 'GROUPED_MEDIA_INVALID': GroupedMediaInvalidError, + 'HASH_INVALID': HashInvalidError, + 'IMAGE_PROCESS_FAILED': ImageProcessFailedError, + 'INLINE_RESULT_EXPIRED': InlineResultExpiredError, + 'INPUT_CONSTRUCTOR_INVALID': InputConstructorInvalidError, + 'INPUT_FETCH_ERROR': InputFetchErrorError, + 'INPUT_FETCH_FAIL': InputFetchFailError, + 'INPUT_LAYER_INVALID': InputLayerInvalidError, + 'INPUT_METHOD_INVALID': InputMethodInvalidError, + 'INPUT_REQUEST_TOO_LONG': InputRequestTooLongError, + 'INPUT_USER_DEACTIVATED': InputUserDeactivatedError, + 'INTERDC_(\\d+)_CALL_ERROR': InterdcCallErrorError, + 'INTERDC_(\\d+)_CALL_RICH_ERROR': InterdcCallRichErrorError, + 'INVITE_HASH_EMPTY': InviteHashEmptyError, + 'INVITE_HASH_EXPIRED': InviteHashExpiredError, + 'INVITE_HASH_INVALID': InviteHashInvalidError, + 'LANG_PACK_INVALID': LangPackInvalidError, + 'LASTNAME_INVALID': LastnameInvalidError, + 'LIMIT_INVALID': LimitInvalidError, + 'LOCATION_INVALID': LocationInvalidError, + 'MAX_ID_INVALID': MaxIdInvalidError, + 'MD5_CHECKSUM_INVALID': Md5ChecksumInvalidError, + 'MEDIA_CAPTION_TOO_LONG': MediaCaptionTooLongError, + 'MEDIA_EMPTY': MediaEmptyError, + 'MEDIA_INVALID': MediaInvalidError, + 'MESSAGE_EDIT_TIME_EXPIRED': MessageEditTimeExpiredError, + 'MESSAGE_EMPTY': MessageEmptyError, + 'MESSAGE_IDS_EMPTY': MessageIdsEmptyError, + 'MESSAGE_ID_INVALID': MessageIdInvalidError, + 'MESSAGE_NOT_MODIFIED': MessageNotModifiedError, + 'MESSAGE_TOO_LONG': MessageTooLongError, + 'MSG_WAIT_FAILED': MsgWaitFailedError, + 'NEW_SALT_INVALID': NewSaltInvalidError, + 'NEW_SETTINGS_INVALID': NewSettingsInvalidError, + 'OFFSET_INVALID': OffsetInvalidError, + 'OFFSET_PEER_ID_INVALID': OffsetPeerIdInvalidError, + 'PACK_SHORT_NAME_INVALID': PackShortNameInvalidError, + 'PACK_SHORT_NAME_OCCUPIED': PackShortNameOccupiedError, + 'PARTICIPANTS_TOO_FEW': ParticipantsTooFewError, + 'PARTICIPANT_VERSION_OUTDATED': ParticipantVersionOutdatedError, + 'PASSWORD_EMPTY': PasswordEmptyError, + 'PASSWORD_HASH_INVALID': PasswordHashInvalidError, + 'PEER_FLOOD': PeerFloodError, + 'PEER_ID_INVALID': PeerIdInvalidError, + 'PEER_ID_NOT_SUPPORTED': PeerIdNotSupportedError, + 'PERSISTENT_TIMESTAMP_EMPTY': PersistentTimestampEmptyError, + 'PERSISTENT_TIMESTAMP_INVALID': PersistentTimestampInvalidError, + 'PHONE_CODE_EMPTY': PhoneCodeEmptyError, + 'PHONE_CODE_EXPIRED': PhoneCodeExpiredError, + 'PHONE_CODE_HASH_EMPTY': PhoneCodeHashEmptyError, + 'PHONE_CODE_INVALID': PhoneCodeInvalidError, + 'PHONE_NUMBER_APP_SIGNUP_FORBIDDEN': PhoneNumberAppSignupForbiddenError, + 'PHONE_NUMBER_BANNED': PhoneNumberBannedError, + 'PHONE_NUMBER_FLOOD': PhoneNumberFloodError, + 'PHONE_NUMBER_INVALID': PhoneNumberInvalidError, + 'PHONE_NUMBER_OCCUPIED': PhoneNumberOccupiedError, + 'PHONE_NUMBER_UNOCCUPIED': PhoneNumberUnoccupiedError, + 'PHONE_PASSWORD_FLOOD': PhonePasswordFloodError, + 'PHONE_PASSWORD_PROTECTED': PhonePasswordProtectedError, + 'PHOTO_CROP_SIZE_SMALL': PhotoCropSizeSmallError, + 'PHOTO_EXT_INVALID': PhotoExtInvalidError, + 'PHOTO_INVALID': PhotoInvalidError, + 'PHOTO_INVALID_DIMENSIONS': PhotoInvalidDimensionsError, + 'PRIVACY_KEY_INVALID': PrivacyKeyInvalidError, + 'QUERY_ID_EMPTY': QueryIdEmptyError, + 'QUERY_ID_INVALID': QueryIdInvalidError, + 'QUERY_TOO_SHORT': QueryTooShortError, + 'RANDOM_ID_INVALID': RandomIdInvalidError, + 'RANDOM_LENGTH_INVALID': RandomLengthInvalidError, + 'RANGES_INVALID': RangesInvalidError, + 'REPLY_MARKUP_INVALID': ReplyMarkupInvalidError, + 'RESULT_TYPE_INVALID': ResultTypeInvalidError, + 'RPC_CALL_FAIL': RpcCallFailError, + 'RPC_MCGET_FAIL': RpcMcgetFailError, + 'RSA_DECRYPT_FAILED': RsaDecryptFailedError, + 'SEARCH_QUERY_EMPTY': SearchQueryEmptyError, + 'SEND_MESSAGE_TYPE_INVALID': SendMessageTypeInvalidError, + 'SHA256_HASH_INVALID': Sha256HashInvalidError, + 'START_PARAM_EMPTY': StartParamEmptyError, + 'START_PARAM_INVALID': StartParamInvalidError, + 'STICKERSET_INVALID': StickersetInvalidError, + 'STICKERS_EMPTY': StickersEmptyError, + 'STICKER_EMOJI_INVALID': StickerEmojiInvalidError, + 'STICKER_FILE_INVALID': StickerFileInvalidError, + 'STICKER_ID_INVALID': StickerIdInvalidError, + 'STICKER_INVALID': StickerInvalidError, + 'STICKER_PNG_DIMENSIONS': StickerPngDimensionsError, + 'TEMP_AUTH_KEY_EMPTY': TempAuthKeyEmptyError, + 'TMP_PASSWORD_DISABLED': TmpPasswordDisabledError, + 'TOKEN_INVALID': TokenInvalidError, + 'TTL_DAYS_INVALID': TtlDaysInvalidError, + 'TYPES_EMPTY': TypesEmptyError, + 'TYPE_CONSTRUCTOR_INVALID': TypeConstructorInvalidError, + 'USERNAME_INVALID': UsernameInvalidError, + 'USERNAME_NOT_MODIFIED': UsernameNotModifiedError, + 'USERNAME_NOT_OCCUPIED': UsernameNotOccupiedError, + 'USERNAME_OCCUPIED': UsernameOccupiedError, + 'USERS_TOO_FEW': UsersTooFewError, + 'USERS_TOO_MUCH': UsersTooMuchError, + 'USER_ADMIN_INVALID': UserAdminInvalidError, + 'USER_ALREADY_PARTICIPANT': UserAlreadyParticipantError, + 'USER_BANNED_IN_CHANNEL': UserBannedInChannelError, + 'USER_BLOCKED': UserBlockedError, + 'USER_BOT': UserBotError, + 'USER_BOT_INVALID': UserBotInvalidError, + 'USER_BOT_REQUIRED': UserBotRequiredError, + 'USER_CREATOR': UserCreatorError, + 'USER_ID_INVALID': UserIdInvalidError, + 'USER_IS_BLOCKED': UserIsBlockedError, + 'USER_IS_BOT': UserIsBotError, + 'USER_KICKED': UserKickedError, + 'USER_NOT_MUTUAL_CONTACT': UserNotMutualContactError, + 'USER_NOT_PARTICIPANT': UserNotParticipantError, + 'WC_CONVERT_URL_INVALID': WcConvertUrlInvalidError, + 'WEBPAGE_CURL_FAILED': WebpageCurlFailedError, + 'WEBPAGE_MEDIA_EMPTY': WebpageMediaEmptyError, + 'YOU_BLOCKED_USER': YouBlockedUserError, + 'CHANNEL_PUBLIC_GROUP_NA': ChannelPublicGroupNaError, + 'CHAT_ADMIN_INVITE_REQUIRED': ChatAdminInviteRequiredError, + 'CHAT_ADMIN_REQUIRED': ChatAdminRequiredError, + 'CHAT_SEND_GIFS_FORBIDDEN': ChatSendGifsForbiddenError, + 'CHAT_SEND_MEDIA_FORBIDDEN': ChatSendMediaForbiddenError, + 'CHAT_SEND_STICKERS_FORBIDDEN': ChatSendStickersForbiddenError, + 'CHAT_WRITE_FORBIDDEN': ChatWriteForbiddenError, + 'MESSAGE_AUTHOR_REQUIRED': MessageAuthorRequiredError, + 'MESSAGE_DELETE_FORBIDDEN': MessageDeleteForbiddenError, + 'RIGHT_FORBIDDEN': RightForbiddenError, + 'USER_BOT_INVALID': UserBotInvalidError, + 'USER_CHANNELS_TOO_MUCH': UserChannelsTooMuchError, + 'USER_IS_BLOCKED': UserIsBlockedError, + 'USER_NOT_MUTUAL_CONTACT': UserNotMutualContactError, + 'USER_PRIVACY_RESTRICTED': UserPrivacyRestrictedError, + 'USER_RESTRICTED': UserRestrictedError, + 'AUTH_RESTART': AuthRestartError, + 'CALL_OCCUPY_FAILED': CallOccupyFailedError, + 'ENCRYPTION_OCCUPY_FAILED': EncryptionOccupyFailedError, + 'HISTORY_GET_FAILED': HistoryGetFailedError, + 'MEMBER_NO_LOCATION': MemberNoLocationError, + 'MEMBER_OCCUPY_PRIMARY_LOC_FAILED': MemberOccupyPrimaryLocFailedError, + 'NEED_CHAT_INVALID': NeedChatInvalidError, + 'NEED_MEMBER_INVALID': NeedMemberInvalidError, + 'PARTICIPANT_CALL_FAILED': ParticipantCallFailedError, + 'PERSISTENT_TIMESTAMP_OUTDATED': PersistentTimestampOutdatedError, + 'PTS_CHANGE_EMPTY': PtsChangeEmptyError, + 'RANDOM_ID_DUPLICATE': RandomIdDuplicateError, + 'REG_ID_GENERATE_FAILED': RegIdGenerateFailedError, + 'STORAGE_CHECK_FAILED': StorageCheckFailedError, + 'STORE_INVALID_SCALAR_TYPE': StoreInvalidScalarTypeError, + 'UNKNOWN_METHOD': UnknownMethodError, +} diff --git a/telethon/tl/all_tlobjects.py b/telethon/tl/all_tlobjects.py new file mode 100644 index 00000000..719730c4 --- /dev/null +++ b/telethon/tl/all_tlobjects.py @@ -0,0 +1,892 @@ +"""File generated by TLObjects' generator. All changes will be ERASED""" + +from . import types, functions + +LAYER = 75 + +tlobjects = { + 0x05162463: types.ResPQ, + 0x83c95aec: types.PQInnerData, + 0x79cb045d: types.ServerDHParamsFail, + 0xd0e8075c: types.ServerDHParamsOk, + 0xb5890dba: types.ServerDHInnerData, + 0x6643b654: types.ClientDHInnerData, + 0x3bcbf734: types.DhGenOk, + 0x46dc1fb9: types.DhGenRetry, + 0xa69dae02: types.DhGenFail, + 0xf660e1d4: types.DestroyAuthKeyOk, + 0x0a9f2259: types.DestroyAuthKeyNone, + 0xea109b13: types.DestroyAuthKeyFail, + 0x60469778: functions.ReqPqRequest, + 0xbe7e8ef1: functions.ReqPqMultiRequest, + 0xd712e4be: functions.ReqDHParamsRequest, + 0xf5045f1f: functions.SetClientDHParamsRequest, + 0xd1435160: functions.DestroyAuthKeyRequest, + 0x62d6b459: types.MsgsAck, + 0xa7eff811: types.BadMsgNotification, + 0xedab447b: types.BadServerSalt, + 0xda69fb52: types.MsgsStateReq, + 0x04deb57d: types.MsgsStateInfo, + 0x8cc0d131: types.MsgsAllInfo, + 0x276d3ec6: types.MsgDetailedInfo, + 0x809db6df: types.MsgNewDetailedInfo, + 0x7d861a08: types.MsgResendReq, + 0x2144ca19: types.RpcError, + 0x5e2ad36e: types.RpcAnswerUnknown, + 0xcd78e586: types.RpcAnswerDroppedRunning, + 0xa43ad8b7: types.RpcAnswerDropped, + 0x0949d9dc: types.FutureSalt, + 0xae500895: types.FutureSalts, + 0x347773c5: types.Pong, + 0xe22045fc: types.DestroySessionOk, + 0x62d350c9: types.DestroySessionNone, + 0x9ec20908: types.NewSessionCreated, + 0x9299359f: types.HttpWait, + 0xd433ad73: types.IpPort, + 0xd997c3c5: types.help.ConfigSimple, + 0x58e4a740: functions.RpcDropAnswerRequest, + 0xb921bd04: functions.GetFutureSaltsRequest, + 0x7abe77ec: functions.PingRequest, + 0xf3427b8c: functions.PingDelayDisconnectRequest, + 0xe7512126: functions.DestroySessionRequest, + 0x9a5f6e95: functions.contest.SaveDeveloperInfoRequest, + 0xc4b9f9bb: types.Error, + 0x56730bcc: types.Null, + 0x7f3b18ea: types.InputPeerEmpty, + 0x7da07ec9: types.InputPeerSelf, + 0x179be863: types.InputPeerChat, + 0x7b8e7de6: types.InputPeerUser, + 0x20adaef8: types.InputPeerChannel, + 0xb98886cf: types.InputUserEmpty, + 0xf7c1b13f: types.InputUserSelf, + 0xd8292816: types.InputUser, + 0xf392b7f4: types.InputPhoneContact, + 0xf52ff27f: types.InputFile, + 0xfa4f0bb5: types.InputFileBig, + 0x9664f57f: types.InputMediaEmpty, + 0x1e287d04: types.InputMediaUploadedPhoto, + 0xb3ba0635: types.InputMediaPhoto, + 0xf9c44144: types.InputMediaGeoPoint, + 0xa6e45987: types.InputMediaContact, + 0x5b38c6c1: types.InputMediaUploadedDocument, + 0x23ab23d2: types.InputMediaDocument, + 0xc13d1c11: types.InputMediaVenue, + 0x4843b0fd: types.InputMediaGifExternal, + 0xe5bbfe1a: types.InputMediaPhotoExternal, + 0xfb52dc99: types.InputMediaDocumentExternal, + 0xd33f43f3: types.InputMediaGame, + 0xf4e096c3: types.InputMediaInvoice, + 0x7b1a118f: types.InputMediaGeoLive, + 0x1ca48f57: types.InputChatPhotoEmpty, + 0x927c55b4: types.InputChatUploadedPhoto, + 0x8953ad37: types.InputChatPhoto, + 0xe4c123d6: types.InputGeoPointEmpty, + 0xf3b7acc9: types.InputGeoPoint, + 0x1cd7bf0d: types.InputPhotoEmpty, + 0xfb95c6c4: types.InputPhoto, + 0x14637196: types.InputFileLocation, + 0xf5235d55: types.InputEncryptedFileLocation, + 0x430f0724: types.InputDocumentFileLocation, + 0x770656a8: types.InputAppEvent, + 0x9db1bc6d: types.PeerUser, + 0xbad0e5bb: types.PeerChat, + 0xbddde532: types.PeerChannel, + 0xaa963b05: types.storage.FileUnknown, + 0x40bc6f52: types.storage.FilePartial, + 0x007efe0e: types.storage.FileJpeg, + 0xcae1aadf: types.storage.FileGif, + 0x0a4f63c0: types.storage.FilePng, + 0xae1e508d: types.storage.FilePdf, + 0x528a0677: types.storage.FileMp3, + 0x4b09ebbc: types.storage.FileMov, + 0xb3cea0e4: types.storage.FileMp4, + 0x1081464c: types.storage.FileWebp, + 0x7c596b46: types.FileLocationUnavailable, + 0x53d69076: types.FileLocation, + 0x200250ba: types.UserEmpty, + 0x2e13f4c3: types.User, + 0x4f11bae1: types.UserProfilePhotoEmpty, + 0xd559d8c8: types.UserProfilePhoto, + 0x09d05049: types.UserStatusEmpty, + 0xedb93949: types.UserStatusOnline, + 0x008c703f: types.UserStatusOffline, + 0xe26f42f1: types.UserStatusRecently, + 0x07bf09fc: types.UserStatusLastWeek, + 0x77ebc742: types.UserStatusLastMonth, + 0x9ba2d800: types.ChatEmpty, + 0xd91cdd54: types.Chat, + 0x07328bdb: types.ChatForbidden, + 0x450b7115: types.Channel, + 0x289da732: types.ChannelForbidden, + 0x2e02a614: types.ChatFull, + 0x76af5481: types.ChannelFull, + 0xc8d7493e: types.ChatParticipant, + 0xda13538a: types.ChatParticipantCreator, + 0xe2d6e436: types.ChatParticipantAdmin, + 0xfc900c2b: types.ChatParticipantsForbidden, + 0x3f460fed: types.ChatParticipants, + 0x37c1011c: types.ChatPhotoEmpty, + 0x6153276a: types.ChatPhoto, + 0x83e5de54: types.MessageEmpty, + 0x44f9b43d: types.Message, + 0x9e19a1f6: types.MessageService, + 0x3ded6320: types.MessageMediaEmpty, + 0x695150d7: types.MessageMediaPhoto, + 0x56e0d474: types.MessageMediaGeo, + 0x5e7d2f39: types.MessageMediaContact, + 0x9f84f49e: types.MessageMediaUnsupported, + 0x9cb070d7: types.MessageMediaDocument, + 0xa32dd600: types.MessageMediaWebPage, + 0x2ec0533f: types.MessageMediaVenue, + 0xfdb19008: types.MessageMediaGame, + 0x84551347: types.MessageMediaInvoice, + 0x7c3c2609: types.MessageMediaGeoLive, + 0xb6aef7b0: types.MessageActionEmpty, + 0xa6638b9a: types.MessageActionChatCreate, + 0xb5a1ce5a: types.MessageActionChatEditTitle, + 0x7fcb13a8: types.MessageActionChatEditPhoto, + 0x95e3fbef: types.MessageActionChatDeletePhoto, + 0x488a7337: types.MessageActionChatAddUser, + 0xb2ae9b0c: types.MessageActionChatDeleteUser, + 0xf89cf5e8: types.MessageActionChatJoinedByLink, + 0x95d2ac92: types.MessageActionChannelCreate, + 0x51bdb021: types.MessageActionChatMigrateTo, + 0xb055eaee: types.MessageActionChannelMigrateFrom, + 0x94bd38ed: types.MessageActionPinMessage, + 0x9fbab604: types.MessageActionHistoryClear, + 0x92a72876: types.MessageActionGameScore, + 0x8f31b327: types.MessageActionPaymentSentMe, + 0x40699cd0: types.MessageActionPaymentSent, + 0x80e11a7f: types.MessageActionPhoneCall, + 0x4792929b: types.MessageActionScreenshotTaken, + 0xfae69f56: types.MessageActionCustomAction, + 0xe4def5db: types.Dialog, + 0x2331b22d: types.PhotoEmpty, + 0x9288dd29: types.Photo, + 0x0e17e23c: types.PhotoSizeEmpty, + 0x77bfb61b: types.PhotoSize, + 0xe9a734fa: types.PhotoCachedSize, + 0x1117dd5f: types.GeoPointEmpty, + 0x2049d70c: types.GeoPoint, + 0x811ea28e: types.auth.CheckedPhone, + 0x5e002502: types.auth.SentCode, + 0xcd050916: types.auth.Authorization, + 0xdf969c2d: types.auth.ExportedAuthorization, + 0xb8bc5b0c: types.InputNotifyPeer, + 0x193b4417: types.InputNotifyUsers, + 0x4a95e84e: types.InputNotifyChats, + 0xa429b886: types.InputNotifyAll, + 0xf03064d8: types.InputPeerNotifyEventsEmpty, + 0xe86a2c74: types.InputPeerNotifyEventsAll, + 0x38935eb2: types.InputPeerNotifySettings, + 0xadd53cb3: types.PeerNotifyEventsEmpty, + 0x6d1ded88: types.PeerNotifyEventsAll, + 0x70a68512: types.PeerNotifySettingsEmpty, + 0x9acda4c0: types.PeerNotifySettings, + 0x818426cd: types.PeerSettings, + 0xccb03657: types.WallPaper, + 0x63117f24: types.WallPaperSolid, + 0x58dbcab8: types.InputReportReasonSpam, + 0x1e22c78d: types.InputReportReasonViolence, + 0x2e59d922: types.InputReportReasonPornography, + 0xe1746d0a: types.InputReportReasonOther, + 0x0f220f3f: types.UserFull, + 0xf911c994: types.Contact, + 0xd0028438: types.ImportedContact, + 0x561bc879: types.ContactBlocked, + 0xd3680c61: types.ContactStatus, + 0x3ace484c: types.contacts.Link, + 0xb74ba9d2: types.contacts.ContactsNotModified, + 0xeae87e42: types.contacts.Contacts, + 0x77d01c3b: types.contacts.ImportedContacts, + 0x1c138d15: types.contacts.Blocked, + 0x900802a1: types.contacts.BlockedSlice, + 0x15ba6c40: types.messages.Dialogs, + 0x71e094f3: types.messages.DialogsSlice, + 0x8c718e87: types.messages.Messages, + 0x0b446ae3: types.messages.MessagesSlice, + 0x99262e37: types.messages.ChannelMessages, + 0x74535f21: types.messages.MessagesNotModified, + 0x64ff9fd5: types.messages.Chats, + 0x9cd81144: types.messages.ChatsSlice, + 0xe5d7d19c: types.messages.ChatFull, + 0xb45c69d1: types.messages.AffectedHistory, + 0x57e2f66c: types.InputMessagesFilterEmpty, + 0x9609a51c: types.InputMessagesFilterPhotos, + 0x9fc00e65: types.InputMessagesFilterVideo, + 0x56e9f0e4: types.InputMessagesFilterPhotoVideo, + 0x9eddf188: types.InputMessagesFilterDocument, + 0x7ef0dd87: types.InputMessagesFilterUrl, + 0xffc86587: types.InputMessagesFilterGif, + 0x50f5c392: types.InputMessagesFilterVoice, + 0x3751b49e: types.InputMessagesFilterMusic, + 0x3a20ecb8: types.InputMessagesFilterChatPhotos, + 0x80c99768: types.InputMessagesFilterPhoneCalls, + 0x7a7c17a4: types.InputMessagesFilterRoundVoice, + 0xb549da53: types.InputMessagesFilterRoundVideo, + 0xc1f8e69a: types.InputMessagesFilterMyMentions, + 0xe7026d0d: types.InputMessagesFilterGeo, + 0xe062db83: types.InputMessagesFilterContacts, + 0x1f2b0afd: types.UpdateNewMessage, + 0x4e90bfd6: types.UpdateMessageID, + 0xa20db0e5: types.UpdateDeleteMessages, + 0x5c486927: types.UpdateUserTyping, + 0x9a65ea1f: types.UpdateChatUserTyping, + 0x07761198: types.UpdateChatParticipants, + 0x1bfbd823: types.UpdateUserStatus, + 0xa7332b73: types.UpdateUserName, + 0x95313b0c: types.UpdateUserPhoto, + 0x2575bbb9: types.UpdateContactRegistered, + 0x9d2e67c5: types.UpdateContactLink, + 0x12bcbd9a: types.UpdateNewEncryptedMessage, + 0x1710f156: types.UpdateEncryptedChatTyping, + 0xb4a2e88d: types.UpdateEncryption, + 0x38fe25b7: types.UpdateEncryptedMessagesRead, + 0xea4b0e5c: types.UpdateChatParticipantAdd, + 0x6e5f8c22: types.UpdateChatParticipantDelete, + 0x8e5e9873: types.UpdateDcOptions, + 0x80ece81a: types.UpdateUserBlocked, + 0xbec268ef: types.UpdateNotifySettings, + 0xebe46819: types.UpdateServiceNotification, + 0xee3b272a: types.UpdatePrivacy, + 0x12b9417b: types.UpdateUserPhone, + 0x9961fd5c: types.UpdateReadHistoryInbox, + 0x2f2f21bf: types.UpdateReadHistoryOutbox, + 0x7f891213: types.UpdateWebPage, + 0x68c13933: types.UpdateReadMessagesContents, + 0xeb0467fb: types.UpdateChannelTooLong, + 0xb6d45656: types.UpdateChannel, + 0x62ba04d9: types.UpdateNewChannelMessage, + 0x4214f37f: types.UpdateReadChannelInbox, + 0xc37521c9: types.UpdateDeleteChannelMessages, + 0x98a12b4b: types.UpdateChannelMessageViews, + 0x6e947941: types.UpdateChatAdmins, + 0xb6901959: types.UpdateChatParticipantAdmin, + 0x688a30aa: types.UpdateNewStickerSet, + 0x0bb2d201: types.UpdateStickerSetsOrder, + 0x43ae3dec: types.UpdateStickerSets, + 0x9375341e: types.UpdateSavedGifs, + 0x54826690: types.UpdateBotInlineQuery, + 0x0e48f964: types.UpdateBotInlineSend, + 0x1b3f4df7: types.UpdateEditChannelMessage, + 0x98592475: types.UpdateChannelPinnedMessage, + 0xe73547e1: types.UpdateBotCallbackQuery, + 0xe40370a3: types.UpdateEditMessage, + 0xf9d27a5a: types.UpdateInlineBotCallbackQuery, + 0x25d6c9c7: types.UpdateReadChannelOutbox, + 0xee2bb969: types.UpdateDraftMessage, + 0x571d2742: types.UpdateReadFeaturedStickers, + 0x9a422c20: types.UpdateRecentStickers, + 0xa229dd06: types.UpdateConfig, + 0x3354678f: types.UpdatePtsChanged, + 0x40771900: types.UpdateChannelWebPage, + 0xd711a2cc: types.UpdateDialogPinned, + 0xd8caf68d: types.UpdatePinnedDialogs, + 0x8317c0c3: types.UpdateBotWebhookJSON, + 0x9b9240a6: types.UpdateBotWebhookJSONQuery, + 0xe0cdc940: types.UpdateBotShippingQuery, + 0x5d2f3aa9: types.UpdateBotPrecheckoutQuery, + 0xab0f6b1e: types.UpdatePhoneCall, + 0x10c2404b: types.UpdateLangPackTooLong, + 0x56022f4d: types.UpdateLangPack, + 0xe511996d: types.UpdateFavedStickers, + 0x89893b45: types.UpdateChannelReadMessagesContents, + 0x7084a7be: types.UpdateContactsReset, + 0x70db6837: types.UpdateChannelAvailableMessages, + 0xa56c2a3e: types.updates.State, + 0x5d75a138: types.updates.DifferenceEmpty, + 0x00f49ca0: types.updates.Difference, + 0xa8fb1981: types.updates.DifferenceSlice, + 0x4afe8f6d: types.updates.DifferenceTooLong, + 0xe317af7e: types.UpdatesTooLong, + 0x914fbf11: types.UpdateShortMessage, + 0x16812688: types.UpdateShortChatMessage, + 0x78d4dec1: types.UpdateShort, + 0x725b04c3: types.UpdatesCombined, + 0x74ae4240: types.Updates, + 0x11f1331c: types.UpdateShortSentMessage, + 0x8dca6aa5: types.photos.Photos, + 0x15051f54: types.photos.PhotosSlice, + 0x20212ca8: types.photos.Photo, + 0x096a18d5: types.upload.File, + 0xea52fe5a: types.upload.FileCdnRedirect, + 0x05d8c6cc: types.DcOption, + 0x9c840964: types.Config, + 0x8e1a1775: types.NearestDc, + 0x8987f311: types.help.AppUpdate, + 0xc45a6536: types.help.NoAppUpdate, + 0x18cb9f78: types.help.InviteText, + 0xab7ec0a0: types.EncryptedChatEmpty, + 0x3bf703dc: types.EncryptedChatWaiting, + 0xc878527e: types.EncryptedChatRequested, + 0xfa56ce36: types.EncryptedChat, + 0x13d6dd27: types.EncryptedChatDiscarded, + 0xf141b5e1: types.InputEncryptedChat, + 0xc21f497e: types.EncryptedFileEmpty, + 0x4a70994c: types.EncryptedFile, + 0x1837c364: types.InputEncryptedFileEmpty, + 0x64bd0306: types.InputEncryptedFileUploaded, + 0x5a17b5e5: types.InputEncryptedFile, + 0x2dc173c8: types.InputEncryptedFileBigUploaded, + 0xed18c118: types.EncryptedMessage, + 0x23734b06: types.EncryptedMessageService, + 0xc0e24635: types.messages.DhConfigNotModified, + 0x2c221edd: types.messages.DhConfig, + 0x560f8935: types.messages.SentEncryptedMessage, + 0x9493ff32: types.messages.SentEncryptedFile, + 0x72f0eaae: types.InputDocumentEmpty, + 0x18798952: types.InputDocument, + 0x36f8c871: types.DocumentEmpty, + 0x87232bc7: types.Document, + 0x17c6b5f6: types.help.Support, + 0x9fd40bd8: types.NotifyPeer, + 0xb4c83b4c: types.NotifyUsers, + 0xc007cec3: types.NotifyChats, + 0x74d07c60: types.NotifyAll, + 0x16bf744e: types.SendMessageTypingAction, + 0xfd5ec8f5: types.SendMessageCancelAction, + 0xa187d66f: types.SendMessageRecordVideoAction, + 0xe9763aec: types.SendMessageUploadVideoAction, + 0xd52f73f7: types.SendMessageRecordAudioAction, + 0xf351d7ab: types.SendMessageUploadAudioAction, + 0xd1d34a26: types.SendMessageUploadPhotoAction, + 0xaa0cd9e4: types.SendMessageUploadDocumentAction, + 0x176f8ba1: types.SendMessageGeoLocationAction, + 0x628cbc6f: types.SendMessageChooseContactAction, + 0xdd6a8f48: types.SendMessageGamePlayAction, + 0x88f27fbc: types.SendMessageRecordRoundAction, + 0x243e1c66: types.SendMessageUploadRoundAction, + 0xb3134d9d: types.contacts.Found, + 0x4f96cb18: types.InputPrivacyKeyStatusTimestamp, + 0xbdfb0426: types.InputPrivacyKeyChatInvite, + 0xfabadc5f: types.InputPrivacyKeyPhoneCall, + 0xbc2eab30: types.PrivacyKeyStatusTimestamp, + 0x500e6dfa: types.PrivacyKeyChatInvite, + 0x3d662b7b: types.PrivacyKeyPhoneCall, + 0x0d09e07b: types.InputPrivacyValueAllowContacts, + 0x184b35ce: types.InputPrivacyValueAllowAll, + 0x131cc67f: types.InputPrivacyValueAllowUsers, + 0x0ba52007: types.InputPrivacyValueDisallowContacts, + 0xd66b66c9: types.InputPrivacyValueDisallowAll, + 0x90110467: types.InputPrivacyValueDisallowUsers, + 0xfffe1bac: types.PrivacyValueAllowContacts, + 0x65427b82: types.PrivacyValueAllowAll, + 0x4d5bbe0c: types.PrivacyValueAllowUsers, + 0xf888fa1a: types.PrivacyValueDisallowContacts, + 0x8b73e763: types.PrivacyValueDisallowAll, + 0x0c7f49b7: types.PrivacyValueDisallowUsers, + 0x554abb6f: types.account.PrivacyRules, + 0xb8d0afdf: types.AccountDaysTTL, + 0x6c37c15c: types.DocumentAttributeImageSize, + 0x11b58939: types.DocumentAttributeAnimated, + 0x6319d612: types.DocumentAttributeSticker, + 0x0ef02ce6: types.DocumentAttributeVideo, + 0x9852f9c6: types.DocumentAttributeAudio, + 0x15590068: types.DocumentAttributeFilename, + 0x9801d2f7: types.DocumentAttributeHasStickers, + 0xf1749a22: types.messages.StickersNotModified, + 0x8a8ecd32: types.messages.Stickers, + 0x12b299d4: types.StickerPack, + 0xe86602c3: types.messages.AllStickersNotModified, + 0xedfd405f: types.messages.AllStickers, + 0xae636f24: types.DisabledFeature, + 0x84d19185: types.messages.AffectedMessages, + 0x5f4f9247: types.ContactLinkUnknown, + 0xfeedd3ad: types.ContactLinkNone, + 0x268f3f59: types.ContactLinkHasPhone, + 0xd502c2d0: types.ContactLinkContact, + 0xeb1477e8: types.WebPageEmpty, + 0xc586da1c: types.WebPagePending, + 0x5f07b4bc: types.WebPage, + 0x85849473: types.WebPageNotModified, + 0x7bf2e6f6: types.Authorization, + 0x1250abde: types.account.Authorizations, + 0x96dabc18: types.account.NoPassword, + 0x7c18141c: types.account.Password, + 0xb7b72ab3: types.account.PasswordSettings, + 0x86916deb: types.account.PasswordInputSettings, + 0x137948a5: types.auth.PasswordRecovery, + 0xa384b779: types.ReceivedNotifyMessage, + 0x69df3769: types.ChatInviteEmpty, + 0xfc2e05bc: types.ChatInviteExported, + 0x5a686d7c: types.ChatInviteAlready, + 0xdb74f558: types.ChatInvite, + 0xffb62b95: types.InputStickerSetEmpty, + 0x9de7a269: types.InputStickerSetID, + 0x861cc8a0: types.InputStickerSetShortName, + 0xcd303b41: types.StickerSet, + 0xb60a24a6: types.messages.StickerSet, + 0xc27ac8c7: types.BotCommand, + 0x98e81d3a: types.BotInfo, + 0xa2fa4880: types.KeyboardButton, + 0x258aff05: types.KeyboardButtonUrl, + 0x683a5e46: types.KeyboardButtonCallback, + 0xb16a6c29: types.KeyboardButtonRequestPhone, + 0xfc796b3f: types.KeyboardButtonRequestGeoLocation, + 0x0568a748: types.KeyboardButtonSwitchInline, + 0x50f41ccf: types.KeyboardButtonGame, + 0xafd93fbb: types.KeyboardButtonBuy, + 0x77608b83: types.KeyboardButtonRow, + 0xa03e5b85: types.ReplyKeyboardHide, + 0xf4108aa0: types.ReplyKeyboardForceReply, + 0x3502758c: types.ReplyKeyboardMarkup, + 0x48a30254: types.ReplyInlineMarkup, + 0xbb92ba95: types.MessageEntityUnknown, + 0xfa04579d: types.MessageEntityMention, + 0x6f635b0d: types.MessageEntityHashtag, + 0x6cef8ac7: types.MessageEntityBotCommand, + 0x6ed02538: types.MessageEntityUrl, + 0x64e475c2: types.MessageEntityEmail, + 0xbd610bc9: types.MessageEntityBold, + 0x826f8b60: types.MessageEntityItalic, + 0x28a20571: types.MessageEntityCode, + 0x73924be0: types.MessageEntityPre, + 0x76a6d327: types.MessageEntityTextUrl, + 0x352dca58: types.MessageEntityMentionName, + 0x208e68c9: types.InputMessageEntityMentionName, + 0xee8c1e86: types.InputChannelEmpty, + 0xafeb712e: types.InputChannel, + 0x7f077ad9: types.contacts.ResolvedPeer, + 0x0ae30253: types.MessageRange, + 0x3e11affb: types.updates.ChannelDifferenceEmpty, + 0x6a9d7b35: types.updates.ChannelDifferenceTooLong, + 0x2064674e: types.updates.ChannelDifference, + 0x94d42ee7: types.ChannelMessagesFilterEmpty, + 0xcd77d957: types.ChannelMessagesFilter, + 0x15ebac1d: types.ChannelParticipant, + 0xa3289a6d: types.ChannelParticipantSelf, + 0xe3e2e1f9: types.ChannelParticipantCreator, + 0xa82fa898: types.ChannelParticipantAdmin, + 0x222c1886: types.ChannelParticipantBanned, + 0xde3f3c79: types.ChannelParticipantsRecent, + 0xb4608969: types.ChannelParticipantsAdmins, + 0xa3b54985: types.ChannelParticipantsKicked, + 0xb0d1865b: types.ChannelParticipantsBots, + 0x1427a5e1: types.ChannelParticipantsBanned, + 0x0656ac4b: types.ChannelParticipantsSearch, + 0xf56ee2a8: types.channels.ChannelParticipants, + 0xf0173fe9: types.channels.ChannelParticipantsNotModified, + 0xd0d9b163: types.channels.ChannelParticipant, + 0xf1ee3e90: types.help.TermsOfService, + 0x162ecc1f: types.FoundGif, + 0x9c750409: types.FoundGifCached, + 0x450a1c0a: types.messages.FoundGifs, + 0xe8025ca2: types.messages.SavedGifsNotModified, + 0x2e0709a5: types.messages.SavedGifs, + 0x3380c786: types.InputBotInlineMessageMediaAuto, + 0x3dcd7a87: types.InputBotInlineMessageText, + 0xc1b15d65: types.InputBotInlineMessageMediaGeo, + 0xaaafadc8: types.InputBotInlineMessageMediaVenue, + 0x2daf01a7: types.InputBotInlineMessageMediaContact, + 0x4b425864: types.InputBotInlineMessageGame, + 0x2cbbe15a: types.InputBotInlineResult, + 0xa8d864a7: types.InputBotInlineResultPhoto, + 0xfff8fdc4: types.InputBotInlineResultDocument, + 0x4fa417f2: types.InputBotInlineResultGame, + 0x764cf810: types.BotInlineMessageMediaAuto, + 0x8c7f65e2: types.BotInlineMessageText, + 0xb722de65: types.BotInlineMessageMediaGeo, + 0x4366232e: types.BotInlineMessageMediaVenue, + 0x35edb4d4: types.BotInlineMessageMediaContact, + 0x9bebaeb9: types.BotInlineResult, + 0x17db940b: types.BotInlineMediaResult, + 0x947ca848: types.messages.BotResults, + 0x5dab1af4: types.ExportedMessageLink, + 0x559ebe6d: types.MessageFwdHeader, + 0x72a3158c: types.auth.CodeTypeSms, + 0x741cd3e3: types.auth.CodeTypeCall, + 0x226ccefb: types.auth.CodeTypeFlashCall, + 0x3dbb5986: types.auth.SentCodeTypeApp, + 0xc000bba2: types.auth.SentCodeTypeSms, + 0x5353e5a7: types.auth.SentCodeTypeCall, + 0xab03c6d9: types.auth.SentCodeTypeFlashCall, + 0x36585ea4: types.messages.BotCallbackAnswer, + 0x26b5dde6: types.messages.MessageEditData, + 0x890c3d89: types.InputBotInlineMessageID, + 0x3c20629f: types.InlineBotSwitchPM, + 0x3371c354: types.messages.PeerDialogs, + 0xedcdc05b: types.TopPeer, + 0xab661b5b: types.TopPeerCategoryBotsPM, + 0x148677e2: types.TopPeerCategoryBotsInline, + 0x0637b7ed: types.TopPeerCategoryCorrespondents, + 0xbd17a14a: types.TopPeerCategoryGroups, + 0x161d9628: types.TopPeerCategoryChannels, + 0x1e76a78c: types.TopPeerCategoryPhoneCalls, + 0xfb834291: types.TopPeerCategoryPeers, + 0xde266ef5: types.contacts.TopPeersNotModified, + 0x70b772a8: types.contacts.TopPeers, + 0xba4baec5: types.DraftMessageEmpty, + 0xfd8e711f: types.DraftMessage, + 0x04ede3cf: types.messages.FeaturedStickersNotModified, + 0xf89d88e5: types.messages.FeaturedStickers, + 0x0b17f890: types.messages.RecentStickersNotModified, + 0x5ce20970: types.messages.RecentStickers, + 0x4fcba9c8: types.messages.ArchivedStickers, + 0x38641628: types.messages.StickerSetInstallResultSuccess, + 0x35e410a8: types.messages.StickerSetInstallResultArchive, + 0x6410a5d2: types.StickerSetCovered, + 0x3407e51b: types.StickerSetMultiCovered, + 0xaed6dbb2: types.MaskCoords, + 0x4a992157: types.InputStickeredMediaPhoto, + 0x0438865b: types.InputStickeredMediaDocument, + 0xbdf9653b: types.Game, + 0x032c3e77: types.InputGameID, + 0xc331e80a: types.InputGameShortName, + 0x58fffcd0: types.HighScore, + 0x9a3bfd99: types.messages.HighScores, + 0xdc3d824f: types.TextEmpty, + 0x744694e0: types.TextPlain, + 0x6724abc4: types.TextBold, + 0xd912a59c: types.TextItalic, + 0xc12622c4: types.TextUnderline, + 0x9bf8bb95: types.TextStrike, + 0x6c3f19b9: types.TextFixed, + 0x3c2884c1: types.TextUrl, + 0xde5a0dd6: types.TextEmail, + 0x7e6260d7: types.TextConcat, + 0x13567e8a: types.PageBlockUnsupported, + 0x70abc3fd: types.PageBlockTitle, + 0x8ffa9a1f: types.PageBlockSubtitle, + 0xbaafe5e0: types.PageBlockAuthorDate, + 0xbfd064ec: types.PageBlockHeader, + 0xf12bb6e1: types.PageBlockSubheader, + 0x467a0766: types.PageBlockParagraph, + 0xc070d93e: types.PageBlockPreformatted, + 0x48870999: types.PageBlockFooter, + 0xdb20b188: types.PageBlockDivider, + 0xce0d37b0: types.PageBlockAnchor, + 0x3a58c7f4: types.PageBlockList, + 0x263d7c26: types.PageBlockBlockquote, + 0x4f4456d3: types.PageBlockPullquote, + 0xe9c69982: types.PageBlockPhoto, + 0xd9d71866: types.PageBlockVideo, + 0x39f23300: types.PageBlockCover, + 0xcde200d1: types.PageBlockEmbed, + 0x292c7be9: types.PageBlockEmbedPost, + 0x08b31c4f: types.PageBlockCollage, + 0x130c8963: types.PageBlockSlideshow, + 0xef1751b5: types.PageBlockChannel, + 0x31b81a7f: types.PageBlockAudio, + 0x8e3f9ebe: types.PagePart, + 0x556ec7aa: types.PageFull, + 0x85e42301: types.PhoneCallDiscardReasonMissed, + 0xe095c1a0: types.PhoneCallDiscardReasonDisconnect, + 0x57adc690: types.PhoneCallDiscardReasonHangup, + 0xfaf7e8c9: types.PhoneCallDiscardReasonBusy, + 0x7d748d04: types.DataJSON, + 0xcb296bf8: types.LabeledPrice, + 0xc30aa358: types.Invoice, + 0xea02c27e: types.PaymentCharge, + 0x1e8caaeb: types.PostAddress, + 0x909c3f94: types.PaymentRequestedInfo, + 0xcdc27a1f: types.PaymentSavedCredentialsCard, + 0xc61acbd8: types.WebDocument, + 0x9bed434d: types.InputWebDocument, + 0xc239d686: types.InputWebFileLocation, + 0x21e753bc: types.upload.WebFile, + 0x3f56aea3: types.payments.PaymentForm, + 0xd1451883: types.payments.ValidatedRequestedInfo, + 0x4e5f810d: types.payments.PaymentResult, + 0x6b56b921: types.payments.PaymentVerficationNeeded, + 0x500911e1: types.payments.PaymentReceipt, + 0xfb8fe43c: types.payments.SavedInfo, + 0xc10eb2cf: types.InputPaymentCredentialsSaved, + 0x3417d728: types.InputPaymentCredentials, + 0x0aa1c39f: types.InputPaymentCredentialsApplePay, + 0xca05d50e: types.InputPaymentCredentialsAndroidPay, + 0xdb64fd34: types.account.TmpPassword, + 0xb6213cdf: types.ShippingOption, + 0xffa0a496: types.InputStickerSetItem, + 0x1e36fded: types.InputPhoneCall, + 0x5366c915: types.PhoneCallEmpty, + 0x1b8f4ad1: types.PhoneCallWaiting, + 0x83761ce4: types.PhoneCallRequested, + 0x6d003d3f: types.PhoneCallAccepted, + 0xffe6ab67: types.PhoneCall, + 0x50ca4de1: types.PhoneCallDiscarded, + 0x9d4c17c0: types.PhoneConnection, + 0xa2bb35cb: types.PhoneCallProtocol, + 0xec82e140: types.phone.PhoneCall, + 0xeea8e46e: types.upload.CdnFileReuploadNeeded, + 0xa99fca4f: types.upload.CdnFile, + 0xc982eaba: types.CdnPublicKey, + 0x5725e40a: types.CdnConfig, + 0xcad181f6: types.LangPackString, + 0x6c47ac9f: types.LangPackStringPluralized, + 0x2979eeb2: types.LangPackStringDeleted, + 0xf385c1f6: types.LangPackDifference, + 0x117698f1: types.LangPackLanguage, + 0x5d7ceba5: types.ChannelAdminRights, + 0x58cf4249: types.ChannelBannedRights, + 0xe6dfb825: types.ChannelAdminLogEventActionChangeTitle, + 0x55188a2e: types.ChannelAdminLogEventActionChangeAbout, + 0x6a4afc38: types.ChannelAdminLogEventActionChangeUsername, + 0xb82f55c3: types.ChannelAdminLogEventActionChangePhoto, + 0x1b7907ae: types.ChannelAdminLogEventActionToggleInvites, + 0x26ae0971: types.ChannelAdminLogEventActionToggleSignatures, + 0xe9e82c18: types.ChannelAdminLogEventActionUpdatePinned, + 0x709b2405: types.ChannelAdminLogEventActionEditMessage, + 0x42e047bb: types.ChannelAdminLogEventActionDeleteMessage, + 0x183040d3: types.ChannelAdminLogEventActionParticipantJoin, + 0xf89777f2: types.ChannelAdminLogEventActionParticipantLeave, + 0xe31c34d8: types.ChannelAdminLogEventActionParticipantInvite, + 0xe6d83d7e: types.ChannelAdminLogEventActionParticipantToggleBan, + 0xd5676710: types.ChannelAdminLogEventActionParticipantToggleAdmin, + 0xb1c3caa7: types.ChannelAdminLogEventActionChangeStickerSet, + 0x5f5c95f1: types.ChannelAdminLogEventActionTogglePreHistoryHidden, + 0x3b5a3e40: types.ChannelAdminLogEvent, + 0xed8af74d: types.channels.AdminLogResults, + 0xea107ae4: types.ChannelAdminLogEventsFilter, + 0x5ce14175: types.PopularContact, + 0x77eec38f: types.CdnFileHash, + 0x9e8fa6d3: types.messages.FavedStickersNotModified, + 0xf37f2f16: types.messages.FavedStickers, + 0x46e1d13d: types.RecentMeUrlUnknown, + 0x8dbc3336: types.RecentMeUrlUser, + 0xa01b22f9: types.RecentMeUrlChat, + 0xeb49081d: types.RecentMeUrlChatInvite, + 0xbc0a57dc: types.RecentMeUrlStickerSet, + 0x0e0310d7: types.help.RecentMeUrls, + 0x31bc3d25: types.InputSingleMedia, + 0xcb9f372d: functions.InvokeAfterMsgRequest, + 0x3dc4b4f0: functions.InvokeAfterMsgsRequest, + 0xc7481da6: functions.InitConnectionRequest, + 0xda9b0d0d: functions.InvokeWithLayerRequest, + 0xbf9459b7: functions.InvokeWithoutUpdatesRequest, + 0x6fe51dfb: functions.auth.CheckPhoneRequest, + 0x86aef0ec: functions.auth.SendCodeRequest, + 0x1b067634: functions.auth.SignUpRequest, + 0xbcd51581: functions.auth.SignInRequest, + 0x5717da40: functions.auth.LogOutRequest, + 0x9fab0d1a: functions.auth.ResetAuthorizationsRequest, + 0x771c1d97: functions.auth.SendInvitesRequest, + 0xe5bfffcd: functions.auth.ExportAuthorizationRequest, + 0xe3ef9613: functions.auth.ImportAuthorizationRequest, + 0xcdd42a05: functions.auth.BindTempAuthKeyRequest, + 0x67a3ff2c: functions.auth.ImportBotAuthorizationRequest, + 0x0a63011e: functions.auth.CheckPasswordRequest, + 0xd897bc66: functions.auth.RequestPasswordRecoveryRequest, + 0x4ea56e92: functions.auth.RecoverPasswordRequest, + 0x3ef1a9bf: functions.auth.ResendCodeRequest, + 0x1f040578: functions.auth.CancelCodeRequest, + 0x8e48a188: functions.auth.DropTempAuthKeysRequest, + 0x001389cc: functions.account.RegisterDeviceRequest, + 0x3076c4bf: functions.account.UnregisterDeviceRequest, + 0x84be5b93: functions.account.UpdateNotifySettingsRequest, + 0x12b3ad31: functions.account.GetNotifySettingsRequest, + 0xdb7e1747: functions.account.ResetNotifySettingsRequest, + 0x78515775: functions.account.UpdateProfileRequest, + 0x6628562c: functions.account.UpdateStatusRequest, + 0xc04cfac2: functions.account.GetWallPapersRequest, + 0xae189d5f: functions.account.ReportPeerRequest, + 0x2714d86c: functions.account.CheckUsernameRequest, + 0x3e0bdd7c: functions.account.UpdateUsernameRequest, + 0xdadbc950: functions.account.GetPrivacyRequest, + 0xc9f81ce8: functions.account.SetPrivacyRequest, + 0x418d4e0b: functions.account.DeleteAccountRequest, + 0x08fc711d: functions.account.GetAccountTTLRequest, + 0x2442485e: functions.account.SetAccountTTLRequest, + 0x08e57deb: functions.account.SendChangePhoneCodeRequest, + 0x70c32edb: functions.account.ChangePhoneRequest, + 0x38df3532: functions.account.UpdateDeviceLockedRequest, + 0xe320c158: functions.account.GetAuthorizationsRequest, + 0xdf77f3bc: functions.account.ResetAuthorizationRequest, + 0x548a30f5: functions.account.GetPasswordRequest, + 0xbc8d11bb: functions.account.GetPasswordSettingsRequest, + 0xfa7c4b86: functions.account.UpdatePasswordSettingsRequest, + 0x1516d7bd: functions.account.SendConfirmPhoneCodeRequest, + 0x5f2178c3: functions.account.ConfirmPhoneRequest, + 0x4a82327e: functions.account.GetTmpPasswordRequest, + 0x0d91a548: functions.users.GetUsersRequest, + 0xca30a5b1: functions.users.GetFullUserRequest, + 0xc4a353ee: functions.contacts.GetStatusesRequest, + 0xc023849f: functions.contacts.GetContactsRequest, + 0x2c800be5: functions.contacts.ImportContactsRequest, + 0x8e953744: functions.contacts.DeleteContactRequest, + 0x59ab389e: functions.contacts.DeleteContactsRequest, + 0x332b49fc: functions.contacts.BlockRequest, + 0xe54100bd: functions.contacts.UnblockRequest, + 0xf57c350f: functions.contacts.GetBlockedRequest, + 0x84e53737: functions.contacts.ExportCardRequest, + 0x4fe196fe: functions.contacts.ImportCardRequest, + 0x11f812d8: functions.contacts.SearchRequest, + 0xf93ccba3: functions.contacts.ResolveUsernameRequest, + 0xd4982db5: functions.contacts.GetTopPeersRequest, + 0x1ae373ac: functions.contacts.ResetTopPeerRatingRequest, + 0x879537f1: functions.contacts.ResetSavedRequest, + 0x4222fa74: functions.messages.GetMessagesRequest, + 0x191ba9c5: functions.messages.GetDialogsRequest, + 0xdcbb8260: functions.messages.GetHistoryRequest, + 0x039e9ea0: functions.messages.SearchRequest, + 0x0e306d3a: functions.messages.ReadHistoryRequest, + 0x1c015b09: functions.messages.DeleteHistoryRequest, + 0xe58e95d2: functions.messages.DeleteMessagesRequest, + 0x05a954c0: functions.messages.ReceivedMessagesRequest, + 0xa3825e50: functions.messages.SetTypingRequest, + 0xfa88427a: functions.messages.SendMessageRequest, + 0xb8d1262b: functions.messages.SendMediaRequest, + 0x708e0195: functions.messages.ForwardMessagesRequest, + 0xcf1592db: functions.messages.ReportSpamRequest, + 0xa8f1709b: functions.messages.HideReportSpamRequest, + 0x3672e09c: functions.messages.GetPeerSettingsRequest, + 0x3c6aa187: functions.messages.GetChatsRequest, + 0x3b831c66: functions.messages.GetFullChatRequest, + 0xdc452855: functions.messages.EditChatTitleRequest, + 0xca4c79d8: functions.messages.EditChatPhotoRequest, + 0xf9a0aa09: functions.messages.AddChatUserRequest, + 0xe0611f16: functions.messages.DeleteChatUserRequest, + 0x09cb126e: functions.messages.CreateChatRequest, + 0x26cf8950: functions.messages.GetDhConfigRequest, + 0xf64daf43: functions.messages.RequestEncryptionRequest, + 0x3dbc0415: functions.messages.AcceptEncryptionRequest, + 0xedd923c5: functions.messages.DiscardEncryptionRequest, + 0x791451ed: functions.messages.SetEncryptedTypingRequest, + 0x7f4b690a: functions.messages.ReadEncryptedHistoryRequest, + 0xa9776773: functions.messages.SendEncryptedRequest, + 0x9a901b66: functions.messages.SendEncryptedFileRequest, + 0x32d439a4: functions.messages.SendEncryptedServiceRequest, + 0x55a5bb66: functions.messages.ReceivedQueueRequest, + 0x4b0c8c0f: functions.messages.ReportEncryptedSpamRequest, + 0x36a73f77: functions.messages.ReadMessageContentsRequest, + 0xae22e045: functions.messages.GetStickersRequest, + 0x1c9618b1: functions.messages.GetAllStickersRequest, + 0x8b68b0cc: functions.messages.GetWebPagePreviewRequest, + 0x7d885289: functions.messages.ExportChatInviteRequest, + 0x3eadb1bb: functions.messages.CheckChatInviteRequest, + 0x6c50051c: functions.messages.ImportChatInviteRequest, + 0x2619a90e: functions.messages.GetStickerSetRequest, + 0xc78fe460: functions.messages.InstallStickerSetRequest, + 0xf96e55de: functions.messages.UninstallStickerSetRequest, + 0xe6df7378: functions.messages.StartBotRequest, + 0xc4c8a55d: functions.messages.GetMessagesViewsRequest, + 0xec8bd9e1: functions.messages.ToggleChatAdminsRequest, + 0xa9e69f2e: functions.messages.EditChatAdminRequest, + 0x15a3b8e3: functions.messages.MigrateChatRequest, + 0x9e3cacb0: functions.messages.SearchGlobalRequest, + 0x78337739: functions.messages.ReorderStickerSetsRequest, + 0x338e2464: functions.messages.GetDocumentByHashRequest, + 0xbf9a776b: functions.messages.SearchGifsRequest, + 0x83bf3d52: functions.messages.GetSavedGifsRequest, + 0x327a30cb: functions.messages.SaveGifRequest, + 0x514e999d: functions.messages.GetInlineBotResultsRequest, + 0xeb5ea206: functions.messages.SetInlineBotResultsRequest, + 0xb16e06fe: functions.messages.SendInlineBotResultRequest, + 0xfda68d36: functions.messages.GetMessageEditDataRequest, + 0x05d1b8dd: functions.messages.EditMessageRequest, + 0xb0e08243: functions.messages.EditInlineBotMessageRequest, + 0x810a9fec: functions.messages.GetBotCallbackAnswerRequest, + 0xd58f130a: functions.messages.SetBotCallbackAnswerRequest, + 0x2d9776b9: functions.messages.GetPeerDialogsRequest, + 0xbc39e14b: functions.messages.SaveDraftRequest, + 0x6a3f8d65: functions.messages.GetAllDraftsRequest, + 0x2dacca4f: functions.messages.GetFeaturedStickersRequest, + 0x5b118126: functions.messages.ReadFeaturedStickersRequest, + 0x5ea192c9: functions.messages.GetRecentStickersRequest, + 0x392718f8: functions.messages.SaveRecentStickerRequest, + 0x8999602d: functions.messages.ClearRecentStickersRequest, + 0x57f17692: functions.messages.GetArchivedStickersRequest, + 0x65b8c79f: functions.messages.GetMaskStickersRequest, + 0xcc5b67cc: functions.messages.GetAttachedStickersRequest, + 0x8ef8ecc0: functions.messages.SetGameScoreRequest, + 0x15ad9f64: functions.messages.SetInlineGameScoreRequest, + 0xe822649d: functions.messages.GetGameHighScoresRequest, + 0x0f635e1b: functions.messages.GetInlineGameHighScoresRequest, + 0x0d0a48c4: functions.messages.GetCommonChatsRequest, + 0xeba80ff0: functions.messages.GetAllChatsRequest, + 0x32ca8f91: functions.messages.GetWebPageRequest, + 0x3289be6a: functions.messages.ToggleDialogPinRequest, + 0x959ff644: functions.messages.ReorderPinnedDialogsRequest, + 0xe254d64e: functions.messages.GetPinnedDialogsRequest, + 0xe5f672fa: functions.messages.SetBotShippingResultsRequest, + 0x09c2dd95: functions.messages.SetBotPrecheckoutResultsRequest, + 0x519bc2b1: functions.messages.UploadMediaRequest, + 0xc97df020: functions.messages.SendScreenshotNotificationRequest, + 0x21ce0b0e: functions.messages.GetFavedStickersRequest, + 0xb9ffc55b: functions.messages.FaveStickerRequest, + 0x46578472: functions.messages.GetUnreadMentionsRequest, + 0x0f0189d3: functions.messages.ReadMentionsRequest, + 0x249431e2: functions.messages.GetRecentLocationsRequest, + 0x2095512f: functions.messages.SendMultiMediaRequest, + 0x5057c497: functions.messages.UploadEncryptedFileRequest, + 0xedd4882a: functions.updates.GetStateRequest, + 0x25939651: functions.updates.GetDifferenceRequest, + 0x03173d78: functions.updates.GetChannelDifferenceRequest, + 0xf0bb5152: functions.photos.UpdateProfilePhotoRequest, + 0x4f32c098: functions.photos.UploadProfilePhotoRequest, + 0x87cf7f2f: functions.photos.DeletePhotosRequest, + 0x91cd32a8: functions.photos.GetUserPhotosRequest, + 0xb304a621: functions.upload.SaveFilePartRequest, + 0xe3a6cfb5: functions.upload.GetFileRequest, + 0xde7b673d: functions.upload.SaveBigFilePartRequest, + 0x24e6818d: functions.upload.GetWebFileRequest, + 0x2000bcc3: functions.upload.GetCdnFileRequest, + 0x1af91c09: functions.upload.ReuploadCdnFileRequest, + 0xf715c87b: functions.upload.GetCdnFileHashesRequest, + 0xc4f9186b: functions.help.GetConfigRequest, + 0x1fb33026: functions.help.GetNearestDcRequest, + 0xae2de196: functions.help.GetAppUpdateRequest, + 0x6f02f748: functions.help.SaveAppLogRequest, + 0x4d392343: functions.help.GetInviteTextRequest, + 0x9cdf08cd: functions.help.GetSupportRequest, + 0x9010ef6f: functions.help.GetAppChangelogRequest, + 0x350170f3: functions.help.GetTermsOfServiceRequest, + 0xec22cfcd: functions.help.SetBotUpdatesStatusRequest, + 0x52029342: functions.help.GetCdnConfigRequest, + 0x3dc0f114: functions.help.GetRecentMeUrlsRequest, + 0xcc104937: functions.channels.ReadHistoryRequest, + 0x84c1fd4e: functions.channels.DeleteMessagesRequest, + 0xd10dd71b: functions.channels.DeleteUserHistoryRequest, + 0xfe087810: functions.channels.ReportSpamRequest, + 0x93d7b347: functions.channels.GetMessagesRequest, + 0x123e05e9: functions.channels.GetParticipantsRequest, + 0x546dd7a6: functions.channels.GetParticipantRequest, + 0x0a7f6bbb: functions.channels.GetChannelsRequest, + 0x08736a09: functions.channels.GetFullChannelRequest, + 0xf4893d7f: functions.channels.CreateChannelRequest, + 0x13e27f1e: functions.channels.EditAboutRequest, + 0x20b88214: functions.channels.EditAdminRequest, + 0x566decd0: functions.channels.EditTitleRequest, + 0xf12e57c9: functions.channels.EditPhotoRequest, + 0x10e6bd2c: functions.channels.CheckUsernameRequest, + 0x3514b3de: functions.channels.UpdateUsernameRequest, + 0x24b524c5: functions.channels.JoinChannelRequest, + 0xf836aa95: functions.channels.LeaveChannelRequest, + 0x199f3a6c: functions.channels.InviteToChannelRequest, + 0xc7560885: functions.channels.ExportInviteRequest, + 0xc0111fe3: functions.channels.DeleteChannelRequest, + 0x49609307: functions.channels.ToggleInvitesRequest, + 0xceb77163: functions.channels.ExportMessageLinkRequest, + 0x1f69b606: functions.channels.ToggleSignaturesRequest, + 0xa72ded52: functions.channels.UpdatePinnedMessageRequest, + 0x8d8d82d7: functions.channels.GetAdminedPublicChannelsRequest, + 0xbfd915cd: functions.channels.EditBannedRequest, + 0x33ddf480: functions.channels.GetAdminLogRequest, + 0xea8ca4f9: functions.channels.SetStickersRequest, + 0xeab5dc38: functions.channels.ReadMessageContentsRequest, + 0xaf369d42: functions.channels.DeleteHistoryRequest, + 0xeabbb94c: functions.channels.TogglePreHistoryHiddenRequest, + 0xaa2769ed: functions.bots.SendCustomRequestRequest, + 0xe6213f4d: functions.bots.AnswerWebhookJSONQueryRequest, + 0x99f09745: functions.payments.GetPaymentFormRequest, + 0xa092a980: functions.payments.GetPaymentReceiptRequest, + 0x770a8e74: functions.payments.ValidateRequestedInfoRequest, + 0x2b8879b3: functions.payments.SendPaymentFormRequest, + 0x227d824b: functions.payments.GetSavedInfoRequest, + 0xd83d70c1: functions.payments.ClearSavedInfoRequest, + 0x9bd86e6a: functions.stickers.CreateStickerSetRequest, + 0xf7760f51: functions.stickers.RemoveStickerFromSetRequest, + 0xffb6d4ca: functions.stickers.ChangeStickerPositionRequest, + 0x8653febe: functions.stickers.AddStickerToSetRequest, + 0x55451fa9: functions.phone.GetCallConfigRequest, + 0x5b95b3d4: functions.phone.RequestCallRequest, + 0x3bd2b4a0: functions.phone.AcceptCallRequest, + 0x2efe1722: functions.phone.ConfirmCallRequest, + 0x17d54f61: functions.phone.ReceivedCallRequest, + 0x78d413a6: functions.phone.DiscardCallRequest, + 0x1c536a34: functions.phone.SetCallRatingRequest, + 0x277add7e: functions.phone.SaveCallDebugRequest, + 0x9ab5c58e: functions.langpack.GetLangPackRequest, + 0x2e1ee318: functions.langpack.GetStringsRequest, + 0x0b2e4d7d: functions.langpack.GetDifferenceRequest, + 0x800fd57d: functions.langpack.GetLanguagesRequest, +} diff --git a/telethon/tl/functions/__init__.py b/telethon/tl/functions/__init__.py new file mode 100644 index 00000000..574d8a9c --- /dev/null +++ b/telethon/tl/functions/__init__.py @@ -0,0 +1,600 @@ +"""File generated by TLObjects' generator. All changes will be ERASED""" +from ...tl.tlobject import TLObject +from . import contest, auth, account, users, contacts, messages, updates, photos, upload, help, channels, bots, payments, stickers, phone, langpack +import os +import struct + + +class DestroyAuthKeyRequest(TLObject): + CONSTRUCTOR_ID = 0xd1435160 + SUBCLASS_OF_ID = 0x8291e68e + + def __init__(self): + super().__init__() + self.result = None + self.content_related = True + + def to_dict(self): + return { + '_': 'DestroyAuthKeyRequest' + } + + def __bytes__(self): + return b''.join(( + b'`QC\xd1', + )) + + @staticmethod + def from_reader(reader): + return DestroyAuthKeyRequest() + + +class DestroySessionRequest(TLObject): + CONSTRUCTOR_ID = 0xe7512126 + SUBCLASS_OF_ID = 0xaf0ce7bd + + def __init__(self, session_id): + """ + :param int session_id: + + :returns DestroySessionRes: Instance of either DestroySessionOk, DestroySessionNone. + """ + super().__init__() + self.result = None + self.content_related = True + + self.session_id = session_id + + def to_dict(self): + return { + '_': 'DestroySessionRequest', + 'session_id': self.session_id + } + + def __bytes__(self): + return b''.join(( + b'&!Q\xe7', + struct.pack('', + TLObject.serialize_bytes(self.username), + )) + + @staticmethod + def from_reader(reader): + _username = reader.tgread_string() + return UpdateUsernameRequest(username=_username) diff --git a/telethon/tl/functions/auth.py b/telethon/tl/functions/auth.py new file mode 100644 index 00000000..7003ce15 --- /dev/null +++ b/telethon/tl/functions/auth.py @@ -0,0 +1,668 @@ +"""File generated by TLObjects' generator. All changes will be ERASED""" +from ...tl.tlobject import TLObject +import os +import struct + + +class BindTempAuthKeyRequest(TLObject): + CONSTRUCTOR_ID = 0xcdd42a05 + SUBCLASS_OF_ID = 0xf5b399ac + + def __init__(self, perm_auth_key_id, nonce, expires_at, encrypted_message): + """ + :param int perm_auth_key_id: + :param int nonce: + :param datetime.datetime | None expires_at: + :param bytes encrypted_message: + + :returns Bool: This type has no constructors. + """ + super().__init__() + self.result = None + self.content_related = True + + self.perm_auth_key_id = perm_auth_key_id + self.nonce = nonce + self.expires_at = expires_at + self.encrypted_message = encrypted_message + + def to_dict(self): + return { + '_': 'BindTempAuthKeyRequest', + 'perm_auth_key_id': self.perm_auth_key_id, + 'nonce': self.nonce, + 'expires_at': self.expires_at, + 'encrypted_message': self.encrypted_message + } + + def __bytes__(self): + return b''.join(( + b'\x05*\xd4\xcd', + struct.pack('', + TLObject.serialize_bytes(self.phone_number), + TLObject.serialize_bytes(self.phone_code_hash), + )) + + @staticmethod + def from_reader(reader): + _phone_number = reader.tgread_string() + _phone_code_hash = reader.tgread_string() + return ResendCodeRequest(phone_number=_phone_number, phone_code_hash=_phone_code_hash) + + +class ResetAuthorizationsRequest(TLObject): + CONSTRUCTOR_ID = 0x9fab0d1a + SUBCLASS_OF_ID = 0xf5b399ac + + def __init__(self): + super().__init__() + self.result = None + self.content_related = True + + def to_dict(self): + return { + '_': 'ResetAuthorizationsRequest' + } + + def __bytes__(self): + return b''.join(( + b'\x1a\r\xab\x9f', + )) + + @staticmethod + def from_reader(reader): + return ResetAuthorizationsRequest() + + +class SendCodeRequest(TLObject): + CONSTRUCTOR_ID = 0x86aef0ec + SUBCLASS_OF_ID = 0x6ce87081 + + def __init__(self, phone_number, api_id, api_hash, allow_flashcall=None, current_number=None): + """ + :param bool | None allow_flashcall: + :param str phone_number: + :param Bool | None current_number: + :param int api_id: + :param str api_hash: + + :returns auth.SentCode: Instance of SentCode. + """ + super().__init__() + self.result = None + self.content_related = True + + self.allow_flashcall = allow_flashcall + self.phone_number = phone_number + self.current_number = current_number + self.api_id = api_id + self.api_hash = api_hash + + def to_dict(self): + return { + '_': 'SendCodeRequest', + 'allow_flashcall': self.allow_flashcall, + 'phone_number': self.phone_number, + 'current_number': self.current_number, + 'api_id': self.api_id, + 'api_hash': self.api_hash + } + + def __bytes__(self): + assert ((self.allow_flashcall or self.allow_flashcall is not None) and (self.current_number or self.current_number is not None)) or ((self.allow_flashcall is None or self.allow_flashcall is False) and (self.current_number is None or self.current_number is False)), 'allow_flashcall, current_number parameters must all be False-y (like None) or all me True-y' + return b''.join(( + b'\xec\xf0\xae\x86', + struct.pack('\x12', + bytes(self.channel), + bytes(self.filter), + struct.pack(': This type has no constructors. + """ + super().__init__() + self.result = None + self.content_related = True + + self.lang_code = lang_code + self.keys = keys + + def to_dict(self): + return { + '_': 'GetStringsRequest', + 'lang_code': self.lang_code, + 'keys': [] if self.keys is None else self.keys[:] + } + + def __bytes__(self): + return b''.join(( + b'\x18\xe3\x1e.', + TLObject.serialize_bytes(self.lang_code), + b'\x15\xc4\xb5\x1c',struct.pack('', + TLObject.serialize_bytes(self.hash), + )) + + @staticmethod + def from_reader(reader): + _hash = reader.tgread_string() + return CheckChatInviteRequest(hash=_hash) + + +class ClearRecentStickersRequest(TLObject): + CONSTRUCTOR_ID = 0x8999602d + SUBCLASS_OF_ID = 0xf5b399ac + + def __init__(self, attached=None): + """ + :param bool | None attached: + + :returns Bool: This type has no constructors. + """ + super().__init__() + self.result = None + self.content_related = True + + self.attached = attached + + def to_dict(self): + return { + '_': 'ClearRecentStickersRequest', + 'attached': self.attached + } + + def __bytes__(self): + return b''.join(( + b'-`\x99\x89', + struct.pack(': This type has no constructors. + """ + super().__init__() + self.result = None + self.content_related = True + + self.media = media + + def to_dict(self): + return { + '_': 'GetAttachedStickersRequest', + 'media': None if self.media is None else self.media.to_dict() + } + + def __bytes__(self): + return b''.join(( + b'\xccg[\xcc', + bytes(self.media), + )) + + @staticmethod + def from_reader(reader): + _media = reader.tgread_object() + return GetAttachedStickersRequest(media=_media) + + +class GetBotCallbackAnswerRequest(TLObject): + CONSTRUCTOR_ID = 0x810a9fec + SUBCLASS_OF_ID = 0x6c4dd18c + + def __init__(self, peer, msg_id, game=None, data=None): + """ + :param bool | None game: + :param InputPeer peer: + :param int msg_id: + :param bytes | None data: + + :returns messages.BotCallbackAnswer: Instance of BotCallbackAnswer. + """ + super().__init__() + self.result = None + self.content_related = True + + self.game = game + self.peer = peer + self.msg_id = msg_id + self.data = data + + def resolve(self, client, utils): + self.peer = utils.get_input_peer(client.get_input_entity(self.peer)) + + def to_dict(self): + return { + '_': 'GetBotCallbackAnswerRequest', + 'game': self.game, + 'peer': None if self.peer is None else self.peer.to_dict(), + 'msg_id': self.msg_id, + 'data': self.data + } + + def __bytes__(self): + return b''.join(( + b'\xec\x9f\n\x81', + struct.pack(': This type has no constructors. + """ + super().__init__() + self.result = None + self.content_related = True + + self.peer = peer + self.id = id + self.increment = increment + + def resolve(self, client, utils): + self.peer = utils.get_input_peer(client.get_input_entity(self.peer)) + + def to_dict(self): + return { + '_': 'GetMessagesViewsRequest', + 'peer': None if self.peer is None else self.peer.to_dict(), + 'id': [] if self.id is None else self.id[:], + 'increment': self.increment + } + + def __bytes__(self): + return b''.join(( + b']\xa5\xc8\xc4', + bytes(self.peer), + b'\x15\xc4\xb5\x1c',struct.pack(': This type has no constructors. + """ + super().__init__() + self.result = None + self.content_related = True + + self.max_id = max_id + + def to_dict(self): + return { + '_': 'ReceivedMessagesRequest', + 'max_id': self.max_id + } + + def __bytes__(self): + return b''.join(( + b'\xc0T\xa9\x05', + struct.pack(': This type has no constructors. + """ + super().__init__() + self.result = None + self.content_related = True + + self.max_qts = max_qts + + def to_dict(self): + return { + '_': 'ReceivedQueueRequest', + 'max_qts': self.max_qts + } + + def __bytes__(self): + return b''.join(( + b'f\xbb\xa5U', + struct.pack(': This type has no constructors. + """ + super().__init__() + self.result = None + self.content_related = True + + self.id = id + + def resolve(self, client, utils): + self.id = [utils.get_input_photo(_x) for _x in self.id] + + def to_dict(self): + return { + '_': 'DeletePhotosRequest', + 'id': [] if self.id is None else [None if x is None else x.to_dict() for x in self.id] + } + + def __bytes__(self): + return b''.join(( + b'/\x7f\xcf\x87', + b'\x15\xc4\xb5\x1c',struct.pack(': This type has no constructors. + """ + super().__init__() + self.result = None + self.content_related = True + + self.file_token = file_token + self.offset = offset + + def to_dict(self): + return { + '_': 'GetCdnFileHashesRequest', + 'file_token': self.file_token, + 'offset': self.offset + } + + def __bytes__(self): + return b''.join(( + b'{\xc8\x15\xf7', + TLObject.serialize_bytes(self.file_token), + struct.pack(': This type has no constructors. + """ + super().__init__() + self.result = None + self.content_related = True + + self.file_token = file_token + self.request_token = request_token + + def to_dict(self): + return { + '_': 'ReuploadCdnFileRequest', + 'file_token': self.file_token, + 'request_token': self.request_token + } + + def __bytes__(self): + return b''.join(( + b'\t\x1c\xf9\x1a', + TLObject.serialize_bytes(self.file_token), + TLObject.serialize_bytes(self.request_token), + )) + + @staticmethod + def from_reader(reader): + _file_token = reader.tgread_bytes() + _request_token = reader.tgread_bytes() + return ReuploadCdnFileRequest(file_token=_file_token, request_token=_request_token) + + +class SaveBigFilePartRequest(TLObject): + CONSTRUCTOR_ID = 0xde7b673d + SUBCLASS_OF_ID = 0xf5b399ac + + def __init__(self, file_id, file_part, file_total_parts, bytes): + """ + :param int file_id: + :param int file_part: + :param int file_total_parts: + :param bytes bytes: + + :returns Bool: This type has no constructors. + """ + super().__init__() + self.result = None + self.content_related = True + + self.file_id = file_id + self.file_part = file_part + self.file_total_parts = file_total_parts + self.bytes = bytes + + def to_dict(self): + return { + '_': 'SaveBigFilePartRequest', + 'file_id': self.file_id, + 'file_part': self.file_part, + 'file_total_parts': self.file_total_parts, + 'bytes': self.bytes + } + + def __bytes__(self): + return b''.join(( + b'=g{\xde', + struct.pack(': This type has no constructors. + """ + super().__init__() + self.result = None + self.content_related = True + + self.id = id + + def resolve(self, client, utils): + self.id = [utils.get_input_user(client.get_input_entity(_x)) for _x in self.id] + + def to_dict(self): + return { + '_': 'GetUsersRequest', + 'id': [] if self.id is None else [None if x is None else x.to_dict() for x in self.id] + } + + def __bytes__(self): + return b''.join(( + b'H\xa5\x91\r', + b'\x15\xc4\xb5\x1c',struct.pack('Z;', + struct.pack('I\xd7\xc8', + struct.pack(',\x03', + struct.pack('m'", + struct.pack('\xd9p\xc0', + bytes(self.text), + TLObject.serialize_bytes(self.language), + )) + + @staticmethod + def from_reader(reader): + _text = reader.tgread_object() + _language = reader.tgread_string() + return PageBlockPreformatted(text=_text, language=_language) + + +class PageBlockPullquote(TLObject): + CONSTRUCTOR_ID = 0x4f4456d3 + SUBCLASS_OF_ID = 0x1aca5644 + + def __init__(self, text, caption): + """ + :param RichText text: + :param RichText caption: + + Constructor for PageBlock: Instance of either PageBlockUnsupported, PageBlockTitle, PageBlockSubtitle, PageBlockAuthorDate, PageBlockHeader, PageBlockSubheader, PageBlockParagraph, PageBlockPreformatted, PageBlockFooter, PageBlockDivider, PageBlockAnchor, PageBlockList, PageBlockBlockquote, PageBlockPullquote, PageBlockPhoto, PageBlockVideo, PageBlockCover, PageBlockEmbed, PageBlockEmbedPost, PageBlockCollage, PageBlockSlideshow, PageBlockChannel, PageBlockAudio. + """ + super().__init__() + + self.text = text + self.caption = caption + + def to_dict(self): + return { + '_': 'PageBlockPullquote', + 'text': None if self.text is None else self.text.to_dict(), + 'caption': None if self.caption is None else self.caption.to_dict() + } + + def __bytes__(self): + return b''.join(( + b'\xd3VDO', + bytes(self.text), + bytes(self.caption), + )) + + @staticmethod + def from_reader(reader): + _text = reader.tgread_object() + _caption = reader.tgread_object() + return PageBlockPullquote(text=_text, caption=_caption) + + +class PageBlockSlideshow(TLObject): + CONSTRUCTOR_ID = 0x130c8963 + SUBCLASS_OF_ID = 0x1aca5644 + + def __init__(self, items, caption): + """ + :param list[PageBlock] items: + :param RichText caption: + + Constructor for PageBlock: Instance of either PageBlockUnsupported, PageBlockTitle, PageBlockSubtitle, PageBlockAuthorDate, PageBlockHeader, PageBlockSubheader, PageBlockParagraph, PageBlockPreformatted, PageBlockFooter, PageBlockDivider, PageBlockAnchor, PageBlockList, PageBlockBlockquote, PageBlockPullquote, PageBlockPhoto, PageBlockVideo, PageBlockCover, PageBlockEmbed, PageBlockEmbedPost, PageBlockCollage, PageBlockSlideshow, PageBlockChannel, PageBlockAudio. + """ + super().__init__() + + self.items = items + self.caption = caption + + def to_dict(self): + return { + '_': 'PageBlockSlideshow', + 'items': [] if self.items is None else [None if x is None else x.to_dict() for x in self.items], + 'caption': None if self.caption is None else self.caption.to_dict() + } + + def __bytes__(self): + return b''.join(( + b'c\x89\x0c\x13', + b'\x15\xc4\xb5\x1c',struct.pack('\xa0', + struct.pack('$', + struct.pack('\xee\xf1', + TLObject.serialize_bytes(self.text), + )) + + @staticmethod + def from_reader(reader): + _text = reader.tgread_string() + return TermsOfService(text=_text) diff --git a/telethon/tl/types/messages.py b/telethon/tl/types/messages.py new file mode 100644 index 00000000..7b5be22c --- /dev/null +++ b/telethon/tl/types/messages.py @@ -0,0 +1,1617 @@ +"""File generated by TLObjects' generator. All changes will be ERASED""" +from ...tl.tlobject import TLObject +import os +import struct + + +class AffectedHistory(TLObject): + CONSTRUCTOR_ID = 0xb45c69d1 + SUBCLASS_OF_ID = 0x2c49c116 + + def __init__(self, pts, pts_count, offset): + """ + :param int pts: + :param int pts_count: + :param int offset: + + Constructor for messages.AffectedHistory: Instance of AffectedHistory. + """ + super().__init__() + + 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): + return b''.join(( + b'\xd1i\\\xb4', + struct.pack('', + struct.pack('*l\xa5', + struct.pack(' limit: + r.dialogs = r.dialogs[:limit] - if len(r.dialogs) < real_limit or not isinstance(r, DialogsSlice): + for d in r.dialogs: + peer_id = utils.get_peer_id(d.peer) + if peer_id not in seen: + seen.add(peer_id) + yield Dialog(self, d, entities, messages) + + if len(r.dialogs) < req.limit or not isinstance(r, DialogsSlice): # Less than we requested means we reached the end, or # we didn't get a DialogsSlice which means we got all. break - offset_date = r.messages[-1].date - offset_peer = entities[utils.get_peer_id(r.dialogs[-1].peer)] - offset_id = r.messages[-1].id + req.offset_date = r.messages[-1].date + req.offset_peer = entities[utils.get_peer_id(r.dialogs[-1].peer)] + req.offset_id = r.messages[-1].id + req.exclude_pinned = True - dialogs = UserList( - itertools.islice(dialogs.values(), min(limit, len(dialogs))) - ) - dialogs.total = total_count + async def get_dialogs(self, *args, **kwargs): + """ + Same as :meth:`iter_dialogs`, but returns a list instead + with an additional .total attribute on the list. + """ + total_box = _Box(0) + kwargs['_total_box'] = total_box + dialogs = UserList() + async for dialog in self.iter_dialogs(*args, **kwargs): + dialogs.append(dialog) + + dialogs.total = total_box.x return dialogs - async def get_drafts(self): # TODO: Ability to provide a `filter` + async def iter_drafts(self): # TODO: Ability to provide a `filter` """ - Gets all open draft messages. + Iterator over all open draft messages. - Returns: - A list of custom ``Draft`` objects that are easy to work with: - You can call ``draft.set_message('text')`` to change the message, - or delete it through :meth:`draft.delete()`. + The yielded items are custom ``Draft`` objects that are easier to use. + You can call ``draft.set_message('text')`` to change the message, + or delete it through :meth:`draft.delete()`. """ - response = await self(GetAllDraftsRequest()) - self.session.process_entities(response) - self.session.generate_sequence(response.seq) - drafts = [Draft._from_update(self, u) for u in response.updates] - return drafts + for update in (await self(GetAllDraftsRequest())).updates: + yield Draft._from_update(self, update) + + async def get_drafts(self): + """ + Same as :meth:`iter_drafts`, but returns a list instead. + """ + return list(await self.iter_drafts()) @staticmethod def _get_response_message(request, result): @@ -668,7 +698,7 @@ class TelegramClient(TelegramBareClient): async def send_message(self, entity, message='', reply_to=None, parse_mode='md', link_preview=True, file=None, - force_document=False): + force_document=False, clear_draft=False): """ Sends the given message to the specified entity (user/chat/channel). @@ -699,6 +729,10 @@ class TelegramClient(TelegramBareClient): force_document (:obj:`bool`, optional): Whether to send the given file as a document or not. + clear_draft (:obj:`bool`, optional): + Whether the existing draft should be cleared or not. + Has no effect when sending a file. + Returns: the sent message """ @@ -729,7 +763,8 @@ class TelegramClient(TelegramBareClient): reply_to_msg_id=reply_id, reply_markup=message.reply_markup, entities=message.entities, - no_webpage=not isinstance(message.media, MessageMediaWebPage) + no_webpage=not isinstance(message.media, MessageMediaWebPage), + clear_draft=clear_draft ) message = message.message else: @@ -739,7 +774,8 @@ class TelegramClient(TelegramBareClient): message=message, entities=msg_ent, no_webpage=not link_preview, - reply_to_msg_id=self._get_message_id(reply_to) + reply_to_msg_id=self._get_message_id(reply_to), + clear_draft=clear_draft ) result = await self(request) @@ -876,10 +912,13 @@ class TelegramClient(TelegramBareClient): Returns: The affected messages. """ + if not utils.is_list_like(message_ids): + message_ids = (message_ids,) - if not isinstance(message_ids, list): - message_ids = [message_ids] - message_ids = [m.id if isinstance(m, Message) else int(m) for m in message_ids] + message_ids = [ + m.id if isinstance(m, (Message, MessageService, MessageEmpty)) + else int(m) for m in message_ids + ] if entity is None: return await self(messages.DeleteMessagesRequest(message_ids, revoke=revoke)) @@ -891,11 +930,11 @@ class TelegramClient(TelegramBareClient): else: return await self(messages.DeleteMessagesRequest(message_ids, revoke=revoke)) - async def get_message_history(self, entity, limit=20, offset_date=None, - offset_id=0, max_id=0, min_id=0, add_offset=0, - batch_size=100, wait_time=None): + async def iter_messages(self, entity, limit=20, offset_date=None, + offset_id=0, max_id=0, min_id=0, add_offset=0, + batch_size=100, wait_time=None, _total_box=None): """ - Gets the message history for the specified entity + Iterator over the message history for the specified entity. Args: entity (:obj:`entity`): @@ -939,10 +978,12 @@ class TelegramClient(TelegramBareClient): If left to ``None``, it will default to 1 second only if the limit is higher than 3000. - Returns: - A list of messages with extra attributes: + _total_box (:obj:`_Box`, optional): + A _Box instance to pass the total parameter by reference. + + Yields: + Instances of ``telethon.tl.types.Message`` with extra attributes: - * ``.total`` = (on the list) total amount of messages sent. * ``.sender`` = entity of the sender. * ``.fwd_from.sender`` = if fwd_from, who sent it originally. * ``.fwd_from.channel`` = if fwd_from, original channel. @@ -958,24 +999,26 @@ class TelegramClient(TelegramBareClient): entity = await self.get_input_entity(entity) limit = float('inf') if limit is None else int(limit) if limit == 0: + if not _total_box: + return # No messages, but we still need to know the total message count result = await self(GetHistoryRequest( peer=entity, limit=1, - offset_date=None, offset_id=0, max_id=0, min_id=0, add_offset=0 + offset_date=None, offset_id=0, max_id=0, min_id=0, + add_offset=0, hash=0 )) - return getattr(result, 'count', len(result.messages)), [], [] + _total_box.x = getattr(result, 'count', len(result.messages)) + return if wait_time is None: wait_time = 1 if limit > 3000 else 0 + have = 0 batch_size = min(max(batch_size, 1), 100) - total_messages = 0 - messages = UserList() - entities = {} - while len(messages) < limit: + while have < limit: # Telegram has a hard limit of 100 - real_limit = min(limit - len(messages), batch_size) - result = await self(GetHistoryRequest( + real_limit = min(limit - have, batch_size) + r = await self(GetHistoryRequest( peer=entity, limit=real_limit, offset_date=offset_date, @@ -985,48 +1028,66 @@ class TelegramClient(TelegramBareClient): add_offset=add_offset, hash=0 )) - messages.extend( - m for m in result.messages if not isinstance(m, MessageEmpty) - ) - total_messages = getattr(result, 'count', len(result.messages)) + if _total_box: + _total_box.x = getattr(r, 'count', len(r.messages)) - for u in result.users: - entities[utils.get_peer_id(u)] = u - for c in result.chats: - entities[utils.get_peer_id(c)] = c + entities = {utils.get_peer_id(x): x + for x in itertools.chain(r.users, r.chats)} - if len(result.messages) < real_limit: + for message in r.messages: + if isinstance(message, MessageEmpty): + continue + + # Add a few extra attributes to the Message to be friendlier. + # To make messages more friendly, always add message + # to service messages, and action to normal messages. + message.message = getattr(message, 'message', None) + message.action = getattr(message, 'action', None) + message.to = entities[utils.get_peer_id(message.to_id)] + message.sender = ( + None if not message.from_id else + entities[utils.get_peer_id(message.from_id)] + ) + if getattr(message, 'fwd_from', None): + message.fwd_from.sender = ( + None if not message.fwd_from.from_id else + entities[utils.get_peer_id(message.fwd_from.from_id)] + ) + message.fwd_from.channel = ( + None if not message.fwd_from.channel_id else + entities[utils.get_peer_id( + PeerChannel(message.fwd_from.channel_id) + )] + ) + yield message + have += 1 + + if len(r.messages) < real_limit: break - offset_id = result.messages[-1].id - offset_date = result.messages[-1].date + offset_id = r.messages[-1].id + offset_date = r.messages[-1].date await asyncio.sleep(wait_time) - # Add a few extra attributes to the Message to make it friendlier. - messages.total = total_messages - for m in messages: - # To make messages more friendly, always add message - # to service messages, and action to normal messages. - m.message = getattr(m, 'message', None) - m.action = getattr(m, 'action', None) - m.sender = (None if not m.from_id else - entities[utils.get_peer_id(m.from_id)]) + async def get_messages(self, *args, **kwargs): + """ + Same as :meth:`iter_messages`, but returns a list instead + with an additional .total attribute on the list. + """ + total_box = _Box(0) + kwargs['_total_box'] = total_box + msgs = UserList() + async for msg in self.iter_messages(*args, **kwargs): + msgs.append(msg) - if getattr(m, 'fwd_from', None): - m.fwd_from.sender = ( - None if not m.fwd_from.from_id else - entities[utils.get_peer_id(m.fwd_from.from_id)] - ) - m.fwd_from.channel = ( - None if not m.fwd_from.channel_id else - entities[utils.get_peer_id( - PeerChannel(m.fwd_from.channel_id) - )] - ) + msgs.total = total_box.x + return msgs - m.to = entities[utils.get_peer_id(m.to_id)] - - return messages + async def get_message_history(self, *args, **kwargs): + warnings.warn( + 'get_message_history is deprecated, use get_messages instead' + ) + return await self.get_messages(*args, **kwargs) async def send_read_acknowledge(self, entity, message=None, max_id=None, clear_mentions=False): @@ -1094,8 +1155,8 @@ class TelegramClient(TelegramBareClient): raise TypeError('Invalid message type: {}'.format(type(message))) - async def get_participants(self, entity, limit=None, search='', - aggressive=False): + async def iter_participants(self, entity, limit=None, search='', + aggressive=False, _total_box=None): """ Gets the list of participants from the specified entity. @@ -1119,6 +1180,9 @@ class TelegramClient(TelegramBareClient): This has no effect for groups or channels with less than 10,000 members. + _total_box (:obj:`_Box`, optional): + A _Box instance to pass the total parameter by reference. + Returns: A list of participants with an additional .total variable on the list indicating the total amount of members in this group/channel. @@ -1129,8 +1193,13 @@ class TelegramClient(TelegramBareClient): total = (await self(GetFullChannelRequest( entity ))).full_chat.participants_count + if _total_box: + _total_box.x = total - all_participants = {} + if limit == 0: + return + + seen = set() if total > 10000 and aggressive: requests = [GetParticipantsRequest( channel=entity, @@ -1170,31 +1239,48 @@ class TelegramClient(TelegramBareClient): else: requests[i].offset += len(participants.users) for user in participants.users: - if len(all_participants) < limit: - all_participants[user.id] = user - if limit < float('inf'): - values = itertools.islice(all_participants.values(), limit) - else: - values = all_participants.values() + if user.id not in seen: + seen.add(user.id) + yield user + if len(seen) >= limit: + return - users = UserList(values) - users.total = total elif isinstance(entity, InputPeerChat): users = (await self(GetFullChatRequest(entity.chat_id))).users - if len(users) > limit: - users = users[:limit] - users = UserList(users) - users.total = len(users) + if _total_box: + _total_box.x = len(users) + + have = 0 + for user in users: + have += 1 + if have > limit: + break + else: + yield user else: - users = UserList([entity]) - users.total = 1 - return users + if _total_box: + _total_box.x = 1 + if limit != 0: + yield await self.get_entity(entity) + + async def get_participants(self, *args, **kwargs): + """ + Same as :meth:`iter_participants`, but returns a list instead + with an additional .total attribute on the list. + """ + total_box = _Box(0) + kwargs['_total_box'] = total_box + participants = UserList() + async for participant in self.iter_participants(*args, **kwargs): + participants.append(participant) + participants.total = total_box.x + return participants # endregion # region Uploading files - async def send_file(self, entity, file, caption=None, + async def send_file(self, entity, file, caption='', force_document=False, progress_callback=None, reply_to=None, attributes=None, @@ -1414,9 +1500,9 @@ class TelegramClient(TelegramBareClient): kwargs['is_voice_note'] = True return self.send_file(*args, **kwargs) - async def _send_album(self, entity, files, caption=None, - progress_callback=None, reply_to=None, - parse_mode='md'): + async def _send_album(self, entity, files, caption='', + progress_callback=None, reply_to=None, + parse_mode='md'): """Specialized version of .send_file for albums""" # We don't care if the user wants to avoid cache, we will use it # anyway. Why? The cached version will be exactly the same thing @@ -1710,7 +1796,8 @@ class TelegramClient(TelegramBareClient): date = datetime.now() media = message - if isinstance(media, (MessageMediaPhoto, Photo)): + if isinstance(media, (MessageMediaPhoto, Photo, + PhotoSize, PhotoCachedSize)): return await self._download_photo( media, file, date, progress_callback ) @@ -1728,24 +1815,39 @@ class TelegramClient(TelegramBareClient): # Determine the photo and its largest size if isinstance(photo, MessageMediaPhoto): photo = photo.photo - if not isinstance(photo, Photo): + if isinstance(photo, Photo): + for size in reversed(photo.sizes): + if not isinstance(size, PhotoSizeEmpty): + photo = size + break + else: + return + if not isinstance(photo, (PhotoSize, PhotoCachedSize)): return - largest_size = photo.sizes[-1] - file_size = largest_size.size - largest_size = largest_size.location - file = self._get_proper_filename(file, 'photo', '.jpg', date=date) + if isinstance(photo, PhotoCachedSize): + # No need to download anything, simply write the bytes + if isinstance(file, str): + helpers.ensure_parent_dir_exists(file) + f = open(file, 'wb') + else: + f = file + try: + f.write(photo.bytes) + finally: + if isinstance(file, str): + f.close() + return file - # Download the media with the largest size input file location await self.download_file( InputFileLocation( - volume_id=largest_size.volume_id, - local_id=largest_size.local_id, - secret=largest_size.secret + volume_id=photo.location.volume_id, + local_id=photo.location.local_id, + secret=photo.location.secret ), file, - file_size=file_size, + file_size=photo.size, progress_callback=progress_callback ) return file @@ -2232,48 +2334,32 @@ class TelegramClient(TelegramBareClient): return InputPeerSelf() return utils.get_input_peer(await self._get_entity_from_string(peer)) - if isinstance(peer, int): - peer, kind = utils.resolve_id(peer) - peer = kind(peer) + original_peer = peer + if not isinstance(peer, int): + try: + if peer.SUBCLASS_OF_ID != 0x2d45687: # crc32(b'Peer') + return utils.get_input_peer(peer) + except (AttributeError, TypeError): + peer = None - try: - is_peer = peer.SUBCLASS_OF_ID == 0x2d45687 # crc32(b'Peer') - if not is_peer: - return utils.get_input_peer(peer) - except (AttributeError, TypeError): - is_peer = False - - if not is_peer: + if not peer: raise TypeError( - 'Cannot turn "{}" into an input entity.'.format(peer) + 'Cannot turn "{}" into an input entity.'.format(original_peer) ) - # Not found, look in the dialogs with the hope to find it. + # Add the mark to the peers if the user passed a Peer (not an int), + # or said ID is negative. If it's negative it's been marked already. + # Look in the dialogs with the hope to find it. + mark = not isinstance(peer, int) or peer < 0 target_id = utils.get_peer_id(peer) - req = GetDialogsRequest( - offset_date=None, - offset_id=0, - offset_peer=InputPeerEmpty(), - limit=100 - ) - while True: - result = await self(req) - entities = {} - for x in itertools.chain(result.users, result.chats): - x_id = utils.get_peer_id(x) - if x_id == target_id: - return utils.get_input_peer(x) - else: - entities[x_id] = x - if len(result.dialogs) < req.limit: - break - - req.offset_id = result.messages[-1].id - req.offset_date = result.messages[-1].date - req.offset_peer = entities[utils.get_peer_id( - result.dialogs[-1].peer - )] - asyncio.sleep(1) + if mark: + async for dialog in self.iter_dialogs(): + if utils.get_peer_id(dialog.entity) == target_id: + return utils.get_input_peer(dialog.entity) + else: + async for dialog in self.iter_dialogs(): + if dialog.entity.id == target_id: + return utils.get_input_peer(dialog.entity) raise TypeError( 'Could not find the input entity corresponding to "{}". ' diff --git a/telethon_aio/tl/custom/draft.py b/telethon_aio/tl/custom/draft.py index e1ff7c91..8a376faa 100644 --- a/telethon_aio/tl/custom/draft.py +++ b/telethon_aio/tl/custom/draft.py @@ -1,5 +1,6 @@ from ..functions.messages import SaveDraftRequest from ..types import UpdateDraftMessage, DraftMessage +from ...extensions import markdown class Draft: @@ -14,11 +15,11 @@ class Draft: if not draft: draft = DraftMessage('', None, None, None, None) - self.text = draft.message + self._text = markdown.unparse(draft.message, draft.entities) + self._raw_text = draft.message self.date = draft.date - self.no_webpage = draft.no_webpage + self.link_preview = not draft.no_webpage self.reply_to_msg_id = draft.reply_to_msg_id - self.entities = draft.entities @classmethod def _from_update(cls, client, update): @@ -38,42 +39,66 @@ class Draft: async def input_entity(self): return await self._client.get_input_entity(self._peer) - async def set_message(self, text, no_webpage=None, reply_to_msg_id=None, entities=None): + @property + def text(self): + return self._text + + @property + def raw_text(self): + return self._raw_text + + async def set_message(self, text=None, reply_to=0, parse_mode='md', + link_preview=None): """ Changes the draft message on the Telegram servers. The changes are - reflected in this object. Changing only individual attributes like for - example the ``reply_to_msg_id`` should be done by providing the current - values of this object, like so: + reflected in this object. - draft.set_message( - draft.text, - no_webpage=draft.no_webpage, - reply_to_msg_id=NEW_VALUE, - entities=draft.entities - ) + :param str text: New text of the draft. + Preserved if left as None. - :param str text: New text of the draft - :param bool no_webpage: Whether to attach a web page preview - :param int reply_to_msg_id: Message id to reply to - :param list entities: A list of formatting entities - :return bool: ``True`` on success + :param int reply_to: Message ID to reply to. + Preserved if left as 0, erased if set to None. + + :param bool link_preview: Whether to attach a web page preview. + Preserved if left as None. + + :param str parse_mode: The parse mode to be used for the text. + :return bool: ``True`` on success. """ + if text is None: + text = self._text + + if reply_to == 0: + reply_to = self.reply_to_msg_id + + if link_preview is None: + link_preview = self.link_preview + + raw_text, entities = await self._client._parse_message_text(text, + parse_mode) result = await self._client(SaveDraftRequest( peer=self._peer, - message=text, - no_webpage=no_webpage, - reply_to_msg_id=reply_to_msg_id, + message=raw_text, + no_webpage=not link_preview, + reply_to_msg_id=reply_to, entities=entities )) if result: - self.text = text - self.no_webpage = no_webpage - self.reply_to_msg_id = reply_to_msg_id - self.entities = entities + self._text = text + self._raw_text = raw_text + self.link_preview = link_preview + self.reply_to_msg_id = reply_to return result + async def send(self, clear=True, parse_mode='md'): + await self._client.send_message(self._peer, self.text, + reply_to=self.reply_to_msg_id, + link_preview=self.link_preview, + parse_mode=parse_mode, + clear_draft=clear) + async def delete(self): """ Deletes this draft diff --git a/telethon_aio/utils.py b/telethon_aio/utils.py index a9311521..daf8c875 100644 --- a/telethon_aio/utils.py +++ b/telethon_aio/utils.py @@ -55,9 +55,6 @@ def get_display_name(entity): return '' -# For some reason, .webp (stickers' format) is not registered -add_type('image/webp', '.webp') - def get_extension(media): """Gets the corresponding extension for any Telegram media""" @@ -319,8 +316,10 @@ def get_input_media(media, is_photo=False): def is_image(file): """Returns True if the file extension looks like an image file""" - return (isinstance(file, str) and - (mimetypes.guess_type(file)[0] or '').startswith('image/')) + if not isinstance(file, str): + return False + mime = mimetypes.guess_type(file)[0] or '' + return mime.startswith('image/') and not mime.endswith('/webp') def is_audio(file): @@ -381,6 +380,17 @@ def parse_username(username): return None, False +def _fix_peer_id(peer_id): + """ + Fixes the peer ID for chats and channels, in case the users + mix marking the ID with the ``Peer()`` constructors. + """ + peer_id = abs(peer_id) + if str(peer_id).startswith('100'): + peer_id = str(peer_id)[3:] + return int(peer_id) + + def get_peer_id(peer): """ Finds the ID of the given peer, and converts it to the "bot api" format @@ -408,6 +418,10 @@ def get_peer_id(peer): if isinstance(peer, (PeerUser, InputPeerUser)): return peer.user_id elif isinstance(peer, (PeerChat, InputPeerChat)): + # Check in case the user mixed things up to avoid blowing up + if not (0 < peer.chat_id <= 0x7fffffff): + peer.chat_id = _fix_peer_id(peer.chat_id) + return -peer.chat_id elif isinstance(peer, (PeerChannel, InputPeerChannel, ChannelFull)): if isinstance(peer, ChannelFull): @@ -416,6 +430,15 @@ def get_peer_id(peer): i = peer.id else: i = peer.channel_id + + # Check in case the user mixed things up to avoid blowing up + if not (0 < i <= 0x7fffffff): + i = _fix_peer_id(i) + if isinstance(peer, ChannelFull): + peer.id = i + else: + peer.channel_id = i + # Concat -100 through math tricks, .to_supergroup() on Madeline # IDs will be strictly positive -> log works return -(i + pow(10, math.floor(math.log10(i) + 3)))