Merge branch 'master' into asyncio

This commit is contained in:
Lonami Exo 2018-03-11 20:14:16 +01:00
commit fd602dfd81
42 changed files with 39561 additions and 242 deletions

View File

@ -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;
}

File diff suppressed because it is too large Load Diff

View File

@ -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,
}

View File

@ -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('<q', self.session_id),
))
@staticmethod
def from_reader(reader):
_session_id = reader.read_long()
return DestroySessionRequest(session_id=_session_id)
class GetFutureSaltsRequest(TLObject):
CONSTRUCTOR_ID = 0xb921bd04
SUBCLASS_OF_ID = 0x1090f517
def __init__(self, num):
"""
:param int num:
:returns FutureSalts: Instance of FutureSalts.
"""
super().__init__()
self.result = None
self.content_related = True
self.num = num
def to_dict(self):
return {
'_': 'GetFutureSaltsRequest',
'num': self.num
}
def __bytes__(self):
return b''.join((
b'\x04\xbd!\xb9',
struct.pack('<i', self.num),
))
@staticmethod
def from_reader(reader):
_num = reader.read_int()
return GetFutureSaltsRequest(num=_num)
class InitConnectionRequest(TLObject):
CONSTRUCTOR_ID = 0xc7481da6
SUBCLASS_OF_ID = 0xb7b2364b
def __init__(self, api_id, device_model, system_version, app_version, system_lang_code, lang_pack, lang_code, query):
"""
:param int api_id:
:param str device_model:
:param str system_version:
:param str app_version:
:param str system_lang_code:
:param str lang_pack:
:param str lang_code:
:param X query:
:returns X: This type has no constructors.
"""
super().__init__()
self.result = None
self.content_related = True
self.api_id = api_id
self.device_model = device_model
self.system_version = system_version
self.app_version = app_version
self.system_lang_code = system_lang_code
self.lang_pack = lang_pack
self.lang_code = lang_code
self.query = query
def to_dict(self):
return {
'_': 'InitConnectionRequest',
'api_id': self.api_id,
'device_model': self.device_model,
'system_version': self.system_version,
'app_version': self.app_version,
'system_lang_code': self.system_lang_code,
'lang_pack': self.lang_pack,
'lang_code': self.lang_code,
'query': None if self.query is None else self.query.to_dict()
}
def __bytes__(self):
return b''.join((
b'\xa6\x1dH\xc7',
struct.pack('<i', self.api_id),
TLObject.serialize_bytes(self.device_model),
TLObject.serialize_bytes(self.system_version),
TLObject.serialize_bytes(self.app_version),
TLObject.serialize_bytes(self.system_lang_code),
TLObject.serialize_bytes(self.lang_pack),
TLObject.serialize_bytes(self.lang_code),
bytes(self.query),
))
@staticmethod
def from_reader(reader):
_api_id = reader.read_int()
_device_model = reader.tgread_string()
_system_version = reader.tgread_string()
_app_version = reader.tgread_string()
_system_lang_code = reader.tgread_string()
_lang_pack = reader.tgread_string()
_lang_code = reader.tgread_string()
_query = reader.tgread_object()
return InitConnectionRequest(api_id=_api_id, device_model=_device_model, system_version=_system_version, app_version=_app_version, system_lang_code=_system_lang_code, lang_pack=_lang_pack, lang_code=_lang_code, query=_query)
class InvokeAfterMsgRequest(TLObject):
CONSTRUCTOR_ID = 0xcb9f372d
SUBCLASS_OF_ID = 0xb7b2364b
def __init__(self, msg_id, query):
"""
:param int msg_id:
:param X query:
:returns X: This type has no constructors.
"""
super().__init__()
self.result = None
self.content_related = True
self.msg_id = msg_id
self.query = query
def to_dict(self):
return {
'_': 'InvokeAfterMsgRequest',
'msg_id': self.msg_id,
'query': None if self.query is None else self.query.to_dict()
}
def __bytes__(self):
return b''.join((
b'-7\x9f\xcb',
struct.pack('<q', self.msg_id),
bytes(self.query),
))
@staticmethod
def from_reader(reader):
_msg_id = reader.read_long()
_query = reader.tgread_object()
return InvokeAfterMsgRequest(msg_id=_msg_id, query=_query)
class InvokeAfterMsgsRequest(TLObject):
CONSTRUCTOR_ID = 0x3dc4b4f0
SUBCLASS_OF_ID = 0xb7b2364b
def __init__(self, msg_ids, query):
"""
:param list[int] msg_ids:
:param X query:
:returns X: This type has no constructors.
"""
super().__init__()
self.result = None
self.content_related = True
self.msg_ids = msg_ids
self.query = query
def to_dict(self):
return {
'_': 'InvokeAfterMsgsRequest',
'msg_ids': [] if self.msg_ids is None else self.msg_ids[:],
'query': None if self.query is None else self.query.to_dict()
}
def __bytes__(self):
return b''.join((
b'\xf0\xb4\xc4=',
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.msg_ids)),b''.join(struct.pack('<q', x) for x in self.msg_ids),
bytes(self.query),
))
@staticmethod
def from_reader(reader):
reader.read_int()
_msg_ids = []
for _ in range(reader.read_int()):
_x = reader.read_long()
_msg_ids.append(_x)
_query = reader.tgread_object()
return InvokeAfterMsgsRequest(msg_ids=_msg_ids, query=_query)
class InvokeWithLayerRequest(TLObject):
CONSTRUCTOR_ID = 0xda9b0d0d
SUBCLASS_OF_ID = 0xb7b2364b
def __init__(self, layer, query):
"""
:param int layer:
:param X query:
:returns X: This type has no constructors.
"""
super().__init__()
self.result = None
self.content_related = True
self.layer = layer
self.query = query
def to_dict(self):
return {
'_': 'InvokeWithLayerRequest',
'layer': self.layer,
'query': None if self.query is None else self.query.to_dict()
}
def __bytes__(self):
return b''.join((
b'\r\r\x9b\xda',
struct.pack('<i', self.layer),
bytes(self.query),
))
@staticmethod
def from_reader(reader):
_layer = reader.read_int()
_query = reader.tgread_object()
return InvokeWithLayerRequest(layer=_layer, query=_query)
class InvokeWithoutUpdatesRequest(TLObject):
CONSTRUCTOR_ID = 0xbf9459b7
SUBCLASS_OF_ID = 0xb7b2364b
def __init__(self, query):
"""
:param X query:
:returns X: This type has no constructors.
"""
super().__init__()
self.result = None
self.content_related = True
self.query = query
def to_dict(self):
return {
'_': 'InvokeWithoutUpdatesRequest',
'query': None if self.query is None else self.query.to_dict()
}
def __bytes__(self):
return b''.join((
b'\xb7Y\x94\xbf',
bytes(self.query),
))
@staticmethod
def from_reader(reader):
_query = reader.tgread_object()
return InvokeWithoutUpdatesRequest(query=_query)
class PingRequest(TLObject):
CONSTRUCTOR_ID = 0x7abe77ec
SUBCLASS_OF_ID = 0x816aee71
def __init__(self, ping_id):
"""
:param int ping_id:
:returns Pong: Instance of Pong.
"""
super().__init__()
self.result = None
self.content_related = True
self.ping_id = ping_id
def to_dict(self):
return {
'_': 'PingRequest',
'ping_id': self.ping_id
}
def __bytes__(self):
return b''.join((
b'\xecw\xbez',
struct.pack('<q', self.ping_id),
))
@staticmethod
def from_reader(reader):
_ping_id = reader.read_long()
return PingRequest(ping_id=_ping_id)
class PingDelayDisconnectRequest(TLObject):
CONSTRUCTOR_ID = 0xf3427b8c
SUBCLASS_OF_ID = 0x816aee71
def __init__(self, ping_id, disconnect_delay):
"""
:param int ping_id:
:param int disconnect_delay:
:returns Pong: Instance of Pong.
"""
super().__init__()
self.result = None
self.content_related = True
self.ping_id = ping_id
self.disconnect_delay = disconnect_delay
def to_dict(self):
return {
'_': 'PingDelayDisconnectRequest',
'ping_id': self.ping_id,
'disconnect_delay': self.disconnect_delay
}
def __bytes__(self):
return b''.join((
b'\x8c{B\xf3',
struct.pack('<q', self.ping_id),
struct.pack('<i', self.disconnect_delay),
))
@staticmethod
def from_reader(reader):
_ping_id = reader.read_long()
_disconnect_delay = reader.read_int()
return PingDelayDisconnectRequest(ping_id=_ping_id, disconnect_delay=_disconnect_delay)
class ReqDHParamsRequest(TLObject):
CONSTRUCTOR_ID = 0xd712e4be
SUBCLASS_OF_ID = 0xa6188d9e
def __init__(self, nonce, server_nonce, p, q, public_key_fingerprint, encrypted_data):
"""
:param int nonce:
:param int server_nonce:
:param bytes p:
:param bytes q:
:param int public_key_fingerprint:
:param bytes encrypted_data:
:returns Server_DH_Params: Instance of either ServerDHParamsFail, ServerDHParamsOk.
"""
super().__init__()
self.result = None
self.content_related = True
self.nonce = nonce
self.server_nonce = server_nonce
self.p = p
self.q = q
self.public_key_fingerprint = public_key_fingerprint
self.encrypted_data = encrypted_data
def to_dict(self):
return {
'_': 'ReqDHParamsRequest',
'nonce': self.nonce,
'server_nonce': self.server_nonce,
'p': self.p,
'q': self.q,
'public_key_fingerprint': self.public_key_fingerprint,
'encrypted_data': self.encrypted_data
}
def __bytes__(self):
return b''.join((
b'\xbe\xe4\x12\xd7',
self.nonce.to_bytes(16, 'little', signed=True),
self.server_nonce.to_bytes(16, 'little', signed=True),
TLObject.serialize_bytes(self.p),
TLObject.serialize_bytes(self.q),
struct.pack('<q', self.public_key_fingerprint),
TLObject.serialize_bytes(self.encrypted_data),
))
@staticmethod
def from_reader(reader):
_nonce = reader.read_large_int(bits=128)
_server_nonce = reader.read_large_int(bits=128)
_p = reader.tgread_bytes()
_q = reader.tgread_bytes()
_public_key_fingerprint = reader.read_long()
_encrypted_data = reader.tgread_bytes()
return ReqDHParamsRequest(nonce=_nonce, server_nonce=_server_nonce, p=_p, q=_q, public_key_fingerprint=_public_key_fingerprint, encrypted_data=_encrypted_data)
class ReqPqRequest(TLObject):
CONSTRUCTOR_ID = 0x60469778
SUBCLASS_OF_ID = 0x786986b8
def __init__(self, nonce):
"""
:param int nonce:
:returns ResPQ: Instance of ResPQ.
"""
super().__init__()
self.result = None
self.content_related = True
self.nonce = nonce
def to_dict(self):
return {
'_': 'ReqPqRequest',
'nonce': self.nonce
}
def __bytes__(self):
return b''.join((
b'x\x97F`',
self.nonce.to_bytes(16, 'little', signed=True),
))
@staticmethod
def from_reader(reader):
_nonce = reader.read_large_int(bits=128)
return ReqPqRequest(nonce=_nonce)
class ReqPqMultiRequest(TLObject):
CONSTRUCTOR_ID = 0xbe7e8ef1
SUBCLASS_OF_ID = 0x786986b8
def __init__(self, nonce):
"""
:param int nonce:
:returns ResPQ: Instance of ResPQ.
"""
super().__init__()
self.result = None
self.content_related = True
self.nonce = nonce
def to_dict(self):
return {
'_': 'ReqPqMultiRequest',
'nonce': self.nonce
}
def __bytes__(self):
return b''.join((
b'\xf1\x8e~\xbe',
self.nonce.to_bytes(16, 'little', signed=True),
))
@staticmethod
def from_reader(reader):
_nonce = reader.read_large_int(bits=128)
return ReqPqMultiRequest(nonce=_nonce)
class RpcDropAnswerRequest(TLObject):
CONSTRUCTOR_ID = 0x58e4a740
SUBCLASS_OF_ID = 0x4bca7570
def __init__(self, req_msg_id):
"""
:param int req_msg_id:
:returns RpcDropAnswer: Instance of either RpcAnswerUnknown, RpcAnswerDroppedRunning, RpcAnswerDropped.
"""
super().__init__()
self.result = None
self.content_related = True
self.req_msg_id = req_msg_id
def to_dict(self):
return {
'_': 'RpcDropAnswerRequest',
'req_msg_id': self.req_msg_id
}
def __bytes__(self):
return b''.join((
b'@\xa7\xe4X',
struct.pack('<q', self.req_msg_id),
))
@staticmethod
def from_reader(reader):
_req_msg_id = reader.read_long()
return RpcDropAnswerRequest(req_msg_id=_req_msg_id)
class SetClientDHParamsRequest(TLObject):
CONSTRUCTOR_ID = 0xf5045f1f
SUBCLASS_OF_ID = 0x55dd6cdb
def __init__(self, nonce, server_nonce, encrypted_data):
"""
:param int nonce:
:param int server_nonce:
:param bytes encrypted_data:
:returns Set_client_DH_params_answer: Instance of either DhGenOk, DhGenRetry, DhGenFail.
"""
super().__init__()
self.result = None
self.content_related = True
self.nonce = nonce
self.server_nonce = server_nonce
self.encrypted_data = encrypted_data
def to_dict(self):
return {
'_': 'SetClientDHParamsRequest',
'nonce': self.nonce,
'server_nonce': self.server_nonce,
'encrypted_data': self.encrypted_data
}
def __bytes__(self):
return b''.join((
b'\x1f_\x04\xf5',
self.nonce.to_bytes(16, 'little', signed=True),
self.server_nonce.to_bytes(16, 'little', signed=True),
TLObject.serialize_bytes(self.encrypted_data),
))
@staticmethod
def from_reader(reader):
_nonce = reader.read_large_int(bits=128)
_server_nonce = reader.read_large_int(bits=128)
_encrypted_data = reader.tgread_bytes()
return SetClientDHParamsRequest(nonce=_nonce, server_nonce=_server_nonce, encrypted_data=_encrypted_data)

File diff suppressed because it is too large Load Diff

View File

@ -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('<q', self.perm_auth_key_id),
struct.pack('<q', self.nonce),
TLObject.serialize_datetime(self.expires_at),
TLObject.serialize_bytes(self.encrypted_message),
))
@staticmethod
def from_reader(reader):
_perm_auth_key_id = reader.read_long()
_nonce = reader.read_long()
_expires_at = reader.tgread_date()
_encrypted_message = reader.tgread_bytes()
return BindTempAuthKeyRequest(perm_auth_key_id=_perm_auth_key_id, nonce=_nonce, expires_at=_expires_at, encrypted_message=_encrypted_message)
class CancelCodeRequest(TLObject):
CONSTRUCTOR_ID = 0x1f040578
SUBCLASS_OF_ID = 0xf5b399ac
def __init__(self, phone_number, phone_code_hash):
"""
:param str phone_number:
:param str phone_code_hash:
:returns Bool: This type has no constructors.
"""
super().__init__()
self.result = None
self.content_related = True
self.phone_number = phone_number
self.phone_code_hash = phone_code_hash
def to_dict(self):
return {
'_': 'CancelCodeRequest',
'phone_number': self.phone_number,
'phone_code_hash': self.phone_code_hash
}
def __bytes__(self):
return b''.join((
b'x\x05\x04\x1f',
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 CancelCodeRequest(phone_number=_phone_number, phone_code_hash=_phone_code_hash)
class CheckPasswordRequest(TLObject):
CONSTRUCTOR_ID = 0xa63011e
SUBCLASS_OF_ID = 0xb9e04e39
def __init__(self, password_hash):
"""
:param bytes password_hash:
:returns auth.Authorization: Instance of Authorization.
"""
super().__init__()
self.result = None
self.content_related = True
self.password_hash = password_hash
def to_dict(self):
return {
'_': 'CheckPasswordRequest',
'password_hash': self.password_hash
}
def __bytes__(self):
return b''.join((
b'\x1e\x01c\n',
TLObject.serialize_bytes(self.password_hash),
))
@staticmethod
def from_reader(reader):
_password_hash = reader.tgread_bytes()
return CheckPasswordRequest(password_hash=_password_hash)
class CheckPhoneRequest(TLObject):
CONSTRUCTOR_ID = 0x6fe51dfb
SUBCLASS_OF_ID = 0x99a3d765
def __init__(self, phone_number):
"""
:param str phone_number:
:returns auth.CheckedPhone: Instance of CheckedPhone.
"""
super().__init__()
self.result = None
self.content_related = True
self.phone_number = phone_number
def to_dict(self):
return {
'_': 'CheckPhoneRequest',
'phone_number': self.phone_number
}
def __bytes__(self):
return b''.join((
b'\xfb\x1d\xe5o',
TLObject.serialize_bytes(self.phone_number),
))
@staticmethod
def from_reader(reader):
_phone_number = reader.tgread_string()
return CheckPhoneRequest(phone_number=_phone_number)
class DropTempAuthKeysRequest(TLObject):
CONSTRUCTOR_ID = 0x8e48a188
SUBCLASS_OF_ID = 0xf5b399ac
def __init__(self, except_auth_keys):
"""
:param list[int] except_auth_keys:
:returns Bool: This type has no constructors.
"""
super().__init__()
self.result = None
self.content_related = True
self.except_auth_keys = except_auth_keys
def to_dict(self):
return {
'_': 'DropTempAuthKeysRequest',
'except_auth_keys': [] if self.except_auth_keys is None else self.except_auth_keys[:]
}
def __bytes__(self):
return b''.join((
b'\x88\xa1H\x8e',
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.except_auth_keys)),b''.join(struct.pack('<q', x) for x in self.except_auth_keys),
))
@staticmethod
def from_reader(reader):
reader.read_int()
_except_auth_keys = []
for _ in range(reader.read_int()):
_x = reader.read_long()
_except_auth_keys.append(_x)
return DropTempAuthKeysRequest(except_auth_keys=_except_auth_keys)
class ExportAuthorizationRequest(TLObject):
CONSTRUCTOR_ID = 0xe5bfffcd
SUBCLASS_OF_ID = 0x5fd1ec51
def __init__(self, dc_id):
"""
:param int dc_id:
:returns auth.ExportedAuthorization: Instance of ExportedAuthorization.
"""
super().__init__()
self.result = None
self.content_related = True
self.dc_id = dc_id
def to_dict(self):
return {
'_': 'ExportAuthorizationRequest',
'dc_id': self.dc_id
}
def __bytes__(self):
return b''.join((
b'\xcd\xff\xbf\xe5',
struct.pack('<i', self.dc_id),
))
@staticmethod
def from_reader(reader):
_dc_id = reader.read_int()
return ExportAuthorizationRequest(dc_id=_dc_id)
class ImportAuthorizationRequest(TLObject):
CONSTRUCTOR_ID = 0xe3ef9613
SUBCLASS_OF_ID = 0xb9e04e39
def __init__(self, id, bytes):
"""
:param int id:
:param bytes bytes:
:returns auth.Authorization: Instance of Authorization.
"""
super().__init__()
self.result = None
self.content_related = True
self.id = id
self.bytes = bytes
def to_dict(self):
return {
'_': 'ImportAuthorizationRequest',
'id': self.id,
'bytes': self.bytes
}
def __bytes__(self):
return b''.join((
b'\x13\x96\xef\xe3',
struct.pack('<i', self.id),
TLObject.serialize_bytes(self.bytes),
))
@staticmethod
def from_reader(reader):
_id = reader.read_int()
_bytes = reader.tgread_bytes()
return ImportAuthorizationRequest(id=_id, bytes=_bytes)
class ImportBotAuthorizationRequest(TLObject):
CONSTRUCTOR_ID = 0x67a3ff2c
SUBCLASS_OF_ID = 0xb9e04e39
def __init__(self, flags, api_id, api_hash, bot_auth_token):
"""
:param int flags:
:param int api_id:
:param str api_hash:
:param str bot_auth_token:
:returns auth.Authorization: Instance of Authorization.
"""
super().__init__()
self.result = None
self.content_related = True
self.flags = flags
self.api_id = api_id
self.api_hash = api_hash
self.bot_auth_token = bot_auth_token
def to_dict(self):
return {
'_': 'ImportBotAuthorizationRequest',
'flags': self.flags,
'api_id': self.api_id,
'api_hash': self.api_hash,
'bot_auth_token': self.bot_auth_token
}
def __bytes__(self):
return b''.join((
b',\xff\xa3g',
struct.pack('<i', self.flags),
struct.pack('<i', self.api_id),
TLObject.serialize_bytes(self.api_hash),
TLObject.serialize_bytes(self.bot_auth_token),
))
@staticmethod
def from_reader(reader):
_flags = reader.read_int()
_api_id = reader.read_int()
_api_hash = reader.tgread_string()
_bot_auth_token = reader.tgread_string()
return ImportBotAuthorizationRequest(flags=_flags, api_id=_api_id, api_hash=_api_hash, bot_auth_token=_bot_auth_token)
class LogOutRequest(TLObject):
CONSTRUCTOR_ID = 0x5717da40
SUBCLASS_OF_ID = 0xf5b399ac
def __init__(self):
super().__init__()
self.result = None
self.content_related = True
def to_dict(self):
return {
'_': 'LogOutRequest'
}
def __bytes__(self):
return b''.join((
b'@\xda\x17W',
))
@staticmethod
def from_reader(reader):
return LogOutRequest()
class RecoverPasswordRequest(TLObject):
CONSTRUCTOR_ID = 0x4ea56e92
SUBCLASS_OF_ID = 0xb9e04e39
def __init__(self, code):
"""
:param str code:
:returns auth.Authorization: Instance of Authorization.
"""
super().__init__()
self.result = None
self.content_related = True
self.code = code
def to_dict(self):
return {
'_': 'RecoverPasswordRequest',
'code': self.code
}
def __bytes__(self):
return b''.join((
b'\x92n\xa5N',
TLObject.serialize_bytes(self.code),
))
@staticmethod
def from_reader(reader):
_code = reader.tgread_string()
return RecoverPasswordRequest(code=_code)
class RequestPasswordRecoveryRequest(TLObject):
CONSTRUCTOR_ID = 0xd897bc66
SUBCLASS_OF_ID = 0xfa72d43a
def __init__(self):
super().__init__()
self.result = None
self.content_related = True
def to_dict(self):
return {
'_': 'RequestPasswordRecoveryRequest'
}
def __bytes__(self):
return b''.join((
b'f\xbc\x97\xd8',
))
@staticmethod
def from_reader(reader):
return RequestPasswordRecoveryRequest()
class ResendCodeRequest(TLObject):
CONSTRUCTOR_ID = 0x3ef1a9bf
SUBCLASS_OF_ID = 0x6ce87081
def __init__(self, phone_number, phone_code_hash):
"""
:param str phone_number:
:param str phone_code_hash:
:returns auth.SentCode: Instance of SentCode.
"""
super().__init__()
self.result = None
self.content_related = True
self.phone_number = phone_number
self.phone_code_hash = phone_code_hash
def to_dict(self):
return {
'_': 'ResendCodeRequest',
'phone_number': self.phone_number,
'phone_code_hash': self.phone_code_hash
}
def __bytes__(self):
return b''.join((
b'\xbf\xa9\xf1>',
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('<I', (0 if self.allow_flashcall is None or self.allow_flashcall is False else 1) | (0 if self.current_number is None or self.current_number is False else 1)),
TLObject.serialize_bytes(self.phone_number),
b'' if self.current_number is None or self.current_number is False else (b'\xb5ur\x99' if self.current_number else b'7\x97y\xbc'),
struct.pack('<i', self.api_id),
TLObject.serialize_bytes(self.api_hash),
))
@staticmethod
def from_reader(reader):
flags = reader.read_int()
_allow_flashcall = bool(flags & 1)
_phone_number = reader.tgread_string()
if flags & 1:
_current_number = reader.tgread_bool()
else:
_current_number = None
_api_id = reader.read_int()
_api_hash = reader.tgread_string()
return SendCodeRequest(phone_number=_phone_number, api_id=_api_id, api_hash=_api_hash, allow_flashcall=_allow_flashcall, current_number=_current_number)
class SendInvitesRequest(TLObject):
CONSTRUCTOR_ID = 0x771c1d97
SUBCLASS_OF_ID = 0xf5b399ac
def __init__(self, phone_numbers, message):
"""
:param list[str] phone_numbers:
:param str message:
:returns Bool: This type has no constructors.
"""
super().__init__()
self.result = None
self.content_related = True
self.phone_numbers = phone_numbers
self.message = message
def to_dict(self):
return {
'_': 'SendInvitesRequest',
'phone_numbers': [] if self.phone_numbers is None else self.phone_numbers[:],
'message': self.message
}
def __bytes__(self):
return b''.join((
b'\x97\x1d\x1cw',
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.phone_numbers)),b''.join(TLObject.serialize_bytes(x) for x in self.phone_numbers),
TLObject.serialize_bytes(self.message),
))
@staticmethod
def from_reader(reader):
reader.read_int()
_phone_numbers = []
for _ in range(reader.read_int()):
_x = reader.tgread_string()
_phone_numbers.append(_x)
_message = reader.tgread_string()
return SendInvitesRequest(phone_numbers=_phone_numbers, message=_message)
class SignInRequest(TLObject):
CONSTRUCTOR_ID = 0xbcd51581
SUBCLASS_OF_ID = 0xb9e04e39
def __init__(self, phone_number, phone_code_hash, phone_code):
"""
:param str phone_number:
:param str phone_code_hash:
:param str phone_code:
:returns auth.Authorization: Instance of Authorization.
"""
super().__init__()
self.result = None
self.content_related = True
self.phone_number = phone_number
self.phone_code_hash = phone_code_hash
self.phone_code = phone_code
def to_dict(self):
return {
'_': 'SignInRequest',
'phone_number': self.phone_number,
'phone_code_hash': self.phone_code_hash,
'phone_code': self.phone_code
}
def __bytes__(self):
return b''.join((
b'\x81\x15\xd5\xbc',
TLObject.serialize_bytes(self.phone_number),
TLObject.serialize_bytes(self.phone_code_hash),
TLObject.serialize_bytes(self.phone_code),
))
@staticmethod
def from_reader(reader):
_phone_number = reader.tgread_string()
_phone_code_hash = reader.tgread_string()
_phone_code = reader.tgread_string()
return SignInRequest(phone_number=_phone_number, phone_code_hash=_phone_code_hash, phone_code=_phone_code)
class SignUpRequest(TLObject):
CONSTRUCTOR_ID = 0x1b067634
SUBCLASS_OF_ID = 0xb9e04e39
def __init__(self, phone_number, phone_code_hash, phone_code, first_name, last_name):
"""
:param str phone_number:
:param str phone_code_hash:
:param str phone_code:
:param str first_name:
:param str last_name:
:returns auth.Authorization: Instance of Authorization.
"""
super().__init__()
self.result = None
self.content_related = True
self.phone_number = phone_number
self.phone_code_hash = phone_code_hash
self.phone_code = phone_code
self.first_name = first_name
self.last_name = last_name
def to_dict(self):
return {
'_': 'SignUpRequest',
'phone_number': self.phone_number,
'phone_code_hash': self.phone_code_hash,
'phone_code': self.phone_code,
'first_name': self.first_name,
'last_name': self.last_name
}
def __bytes__(self):
return b''.join((
b'4v\x06\x1b',
TLObject.serialize_bytes(self.phone_number),
TLObject.serialize_bytes(self.phone_code_hash),
TLObject.serialize_bytes(self.phone_code),
TLObject.serialize_bytes(self.first_name),
TLObject.serialize_bytes(self.last_name),
))
@staticmethod
def from_reader(reader):
_phone_number = reader.tgread_string()
_phone_code_hash = reader.tgread_string()
_phone_code = reader.tgread_string()
_first_name = reader.tgread_string()
_last_name = reader.tgread_string()
return SignUpRequest(phone_number=_phone_number, phone_code_hash=_phone_code_hash, phone_code=_phone_code, first_name=_first_name, last_name=_last_name)

View File

@ -0,0 +1,82 @@
"""File generated by TLObjects' generator. All changes will be ERASED"""
from ...tl.tlobject import TLObject
import os
import struct
class AnswerWebhookJSONQueryRequest(TLObject):
CONSTRUCTOR_ID = 0xe6213f4d
SUBCLASS_OF_ID = 0xf5b399ac
def __init__(self, query_id, data):
"""
:param int query_id:
:param DataJSON data:
:returns Bool: This type has no constructors.
"""
super().__init__()
self.result = None
self.content_related = True
self.query_id = query_id
self.data = data
def to_dict(self):
return {
'_': 'AnswerWebhookJSONQueryRequest',
'query_id': self.query_id,
'data': None if self.data is None else self.data.to_dict()
}
def __bytes__(self):
return b''.join((
b'M?!\xe6',
struct.pack('<q', self.query_id),
bytes(self.data),
))
@staticmethod
def from_reader(reader):
_query_id = reader.read_long()
_data = reader.tgread_object()
return AnswerWebhookJSONQueryRequest(query_id=_query_id, data=_data)
class SendCustomRequestRequest(TLObject):
CONSTRUCTOR_ID = 0xaa2769ed
SUBCLASS_OF_ID = 0xad0352e8
def __init__(self, custom_method, params):
"""
:param str custom_method:
:param DataJSON params:
:returns DataJSON: Instance of DataJSON.
"""
super().__init__()
self.result = None
self.content_related = True
self.custom_method = custom_method
self.params = params
def to_dict(self):
return {
'_': 'SendCustomRequestRequest',
'custom_method': self.custom_method,
'params': None if self.params is None else self.params.to_dict()
}
def __bytes__(self):
return b''.join((
b"\xedi'\xaa",
TLObject.serialize_bytes(self.custom_method),
bytes(self.params),
))
@staticmethod
def from_reader(reader):
_custom_method = reader.tgread_string()
_params = reader.tgread_object()
return SendCustomRequestRequest(custom_method=_custom_method, params=_params)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,571 @@
"""File generated by TLObjects' generator. All changes will be ERASED"""
from ...tl.tlobject import TLObject
import os
import struct
class BlockRequest(TLObject):
CONSTRUCTOR_ID = 0x332b49fc
SUBCLASS_OF_ID = 0xf5b399ac
def __init__(self, id):
"""
:param InputUser id:
:returns Bool: 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(self.id))
def to_dict(self):
return {
'_': 'BlockRequest',
'id': None if self.id is None else self.id.to_dict()
}
def __bytes__(self):
return b''.join((
b'\xfcI+3',
bytes(self.id),
))
@staticmethod
def from_reader(reader):
_id = reader.tgread_object()
return BlockRequest(id=_id)
class DeleteContactRequest(TLObject):
CONSTRUCTOR_ID = 0x8e953744
SUBCLASS_OF_ID = 0x524d5ae9
def __init__(self, id):
"""
:param InputUser id:
:returns contacts.Link: Instance of Link.
"""
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(self.id))
def to_dict(self):
return {
'_': 'DeleteContactRequest',
'id': None if self.id is None else self.id.to_dict()
}
def __bytes__(self):
return b''.join((
b'D7\x95\x8e',
bytes(self.id),
))
@staticmethod
def from_reader(reader):
_id = reader.tgread_object()
return DeleteContactRequest(id=_id)
class DeleteContactsRequest(TLObject):
CONSTRUCTOR_ID = 0x59ab389e
SUBCLASS_OF_ID = 0xf5b399ac
def __init__(self, id):
"""
:param list[InputUser] id:
:returns Bool: 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 {
'_': 'DeleteContactsRequest',
'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'\x9e8\xabY',
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.id)),b''.join(bytes(x) for x in self.id),
))
@staticmethod
def from_reader(reader):
reader.read_int()
_id = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_id.append(_x)
return DeleteContactsRequest(id=_id)
class ExportCardRequest(TLObject):
CONSTRUCTOR_ID = 0x84e53737
SUBCLASS_OF_ID = 0x5026710f
def __init__(self):
super().__init__()
self.result = None
self.content_related = True
def to_dict(self):
return {
'_': 'ExportCardRequest'
}
def __bytes__(self):
return b''.join((
b'77\xe5\x84',
))
@staticmethod
def from_reader(reader):
return ExportCardRequest()
def on_response(self, reader):
reader.read_int() # Vector ID
count = reader.read_int()
self.result = [reader.read_int() for _ in range(count)]
class GetBlockedRequest(TLObject):
CONSTRUCTOR_ID = 0xf57c350f
SUBCLASS_OF_ID = 0xffba4f4f
def __init__(self, offset, limit):
"""
:param int offset:
:param int limit:
:returns contacts.Blocked: Instance of either Blocked, BlockedSlice.
"""
super().__init__()
self.result = None
self.content_related = True
self.offset = offset
self.limit = limit
def to_dict(self):
return {
'_': 'GetBlockedRequest',
'offset': self.offset,
'limit': self.limit
}
def __bytes__(self):
return b''.join((
b'\x0f5|\xf5',
struct.pack('<i', self.offset),
struct.pack('<i', self.limit),
))
@staticmethod
def from_reader(reader):
_offset = reader.read_int()
_limit = reader.read_int()
return GetBlockedRequest(offset=_offset, limit=_limit)
class GetContactsRequest(TLObject):
CONSTRUCTOR_ID = 0xc023849f
SUBCLASS_OF_ID = 0x38be25f6
def __init__(self, hash):
"""
:param int hash:
:returns contacts.Contacts: Instance of either ContactsNotModified, Contacts.
"""
super().__init__()
self.result = None
self.content_related = True
self.hash = hash
def to_dict(self):
return {
'_': 'GetContactsRequest',
'hash': self.hash
}
def __bytes__(self):
return b''.join((
b'\x9f\x84#\xc0',
struct.pack('<i', self.hash),
))
@staticmethod
def from_reader(reader):
_hash = reader.read_int()
return GetContactsRequest(hash=_hash)
class GetStatusesRequest(TLObject):
CONSTRUCTOR_ID = 0xc4a353ee
SUBCLASS_OF_ID = 0xdf815c90
def __init__(self):
super().__init__()
self.result = None
self.content_related = True
def to_dict(self):
return {
'_': 'GetStatusesRequest'
}
def __bytes__(self):
return b''.join((
b'\xeeS\xa3\xc4',
))
@staticmethod
def from_reader(reader):
return GetStatusesRequest()
class GetTopPeersRequest(TLObject):
CONSTRUCTOR_ID = 0xd4982db5
SUBCLASS_OF_ID = 0x9ee8bb88
def __init__(self, offset, limit, hash, correspondents=None, bots_pm=None, bots_inline=None, phone_calls=None, groups=None, channels=None):
"""
:param bool | None correspondents:
:param bool | None bots_pm:
:param bool | None bots_inline:
:param bool | None phone_calls:
:param bool | None groups:
:param bool | None channels:
:param int offset:
:param int limit:
:param int hash:
:returns contacts.TopPeers: Instance of either TopPeersNotModified, TopPeers.
"""
super().__init__()
self.result = None
self.content_related = True
self.correspondents = correspondents
self.bots_pm = bots_pm
self.bots_inline = bots_inline
self.phone_calls = phone_calls
self.groups = groups
self.channels = channels
self.offset = offset
self.limit = limit
self.hash = hash
def to_dict(self):
return {
'_': 'GetTopPeersRequest',
'correspondents': self.correspondents,
'bots_pm': self.bots_pm,
'bots_inline': self.bots_inline,
'phone_calls': self.phone_calls,
'groups': self.groups,
'channels': self.channels,
'offset': self.offset,
'limit': self.limit,
'hash': self.hash
}
def __bytes__(self):
return b''.join((
b'\xb5-\x98\xd4',
struct.pack('<I', (0 if self.correspondents is None or self.correspondents is False else 1) | (0 if self.bots_pm is None or self.bots_pm is False else 2) | (0 if self.bots_inline is None or self.bots_inline is False else 4) | (0 if self.phone_calls is None or self.phone_calls is False else 8) | (0 if self.groups is None or self.groups is False else 1024) | (0 if self.channels is None or self.channels is False else 32768)),
struct.pack('<i', self.offset),
struct.pack('<i', self.limit),
struct.pack('<i', self.hash),
))
@staticmethod
def from_reader(reader):
flags = reader.read_int()
_correspondents = bool(flags & 1)
_bots_pm = bool(flags & 2)
_bots_inline = bool(flags & 4)
_phone_calls = bool(flags & 8)
_groups = bool(flags & 1024)
_channels = bool(flags & 32768)
_offset = reader.read_int()
_limit = reader.read_int()
_hash = reader.read_int()
return GetTopPeersRequest(offset=_offset, limit=_limit, hash=_hash, correspondents=_correspondents, bots_pm=_bots_pm, bots_inline=_bots_inline, phone_calls=_phone_calls, groups=_groups, channels=_channels)
class ImportCardRequest(TLObject):
CONSTRUCTOR_ID = 0x4fe196fe
SUBCLASS_OF_ID = 0x2da17977
def __init__(self, export_card):
"""
:param list[int] export_card:
:returns User: Instance of either UserEmpty, User.
"""
super().__init__()
self.result = None
self.content_related = True
self.export_card = export_card
def to_dict(self):
return {
'_': 'ImportCardRequest',
'export_card': [] if self.export_card is None else self.export_card[:]
}
def __bytes__(self):
return b''.join((
b'\xfe\x96\xe1O',
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.export_card)),b''.join(struct.pack('<i', x) for x in self.export_card),
))
@staticmethod
def from_reader(reader):
reader.read_int()
_export_card = []
for _ in range(reader.read_int()):
_x = reader.read_int()
_export_card.append(_x)
return ImportCardRequest(export_card=_export_card)
class ImportContactsRequest(TLObject):
CONSTRUCTOR_ID = 0x2c800be5
SUBCLASS_OF_ID = 0x8172ad93
def __init__(self, contacts):
"""
:param list[InputContact] contacts:
:returns contacts.ImportedContacts: Instance of ImportedContacts.
"""
super().__init__()
self.result = None
self.content_related = True
self.contacts = contacts
def to_dict(self):
return {
'_': 'ImportContactsRequest',
'contacts': [] if self.contacts is None else [None if x is None else x.to_dict() for x in self.contacts]
}
def __bytes__(self):
return b''.join((
b'\xe5\x0b\x80,',
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.contacts)),b''.join(bytes(x) for x in self.contacts),
))
@staticmethod
def from_reader(reader):
reader.read_int()
_contacts = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_contacts.append(_x)
return ImportContactsRequest(contacts=_contacts)
class ResetSavedRequest(TLObject):
CONSTRUCTOR_ID = 0x879537f1
SUBCLASS_OF_ID = 0xf5b399ac
def __init__(self):
super().__init__()
self.result = None
self.content_related = True
def to_dict(self):
return {
'_': 'ResetSavedRequest'
}
def __bytes__(self):
return b''.join((
b'\xf17\x95\x87',
))
@staticmethod
def from_reader(reader):
return ResetSavedRequest()
class ResetTopPeerRatingRequest(TLObject):
CONSTRUCTOR_ID = 0x1ae373ac
SUBCLASS_OF_ID = 0xf5b399ac
def __init__(self, category, peer):
"""
:param TopPeerCategory category:
:param InputPeer peer:
:returns Bool: This type has no constructors.
"""
super().__init__()
self.result = None
self.content_related = True
self.category = category
self.peer = peer
def resolve(self, client, utils):
self.peer = utils.get_input_peer(client.get_input_entity(self.peer))
def to_dict(self):
return {
'_': 'ResetTopPeerRatingRequest',
'category': None if self.category is None else self.category.to_dict(),
'peer': None if self.peer is None else self.peer.to_dict()
}
def __bytes__(self):
return b''.join((
b'\xacs\xe3\x1a',
bytes(self.category),
bytes(self.peer),
))
@staticmethod
def from_reader(reader):
_category = reader.tgread_object()
_peer = reader.tgread_object()
return ResetTopPeerRatingRequest(category=_category, peer=_peer)
class ResolveUsernameRequest(TLObject):
CONSTRUCTOR_ID = 0xf93ccba3
SUBCLASS_OF_ID = 0xf065b3a8
def __init__(self, username):
"""
:param str username:
:returns contacts.ResolvedPeer: Instance of ResolvedPeer.
"""
super().__init__()
self.result = None
self.content_related = True
self.username = username
def to_dict(self):
return {
'_': 'ResolveUsernameRequest',
'username': self.username
}
def __bytes__(self):
return b''.join((
b'\xa3\xcb<\xf9',
TLObject.serialize_bytes(self.username),
))
@staticmethod
def from_reader(reader):
_username = reader.tgread_string()
return ResolveUsernameRequest(username=_username)
class SearchRequest(TLObject):
CONSTRUCTOR_ID = 0x11f812d8
SUBCLASS_OF_ID = 0x4386a2e3
def __init__(self, q, limit):
"""
:param str q:
:param int limit:
:returns contacts.Found: Instance of Found.
"""
super().__init__()
self.result = None
self.content_related = True
self.q = q
self.limit = limit
def to_dict(self):
return {
'_': 'SearchRequest',
'q': self.q,
'limit': self.limit
}
def __bytes__(self):
return b''.join((
b'\xd8\x12\xf8\x11',
TLObject.serialize_bytes(self.q),
struct.pack('<i', self.limit),
))
@staticmethod
def from_reader(reader):
_q = reader.tgread_string()
_limit = reader.read_int()
return SearchRequest(q=_q, limit=_limit)
class UnblockRequest(TLObject):
CONSTRUCTOR_ID = 0xe54100bd
SUBCLASS_OF_ID = 0xf5b399ac
def __init__(self, id):
"""
:param InputUser id:
:returns Bool: 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(self.id))
def to_dict(self):
return {
'_': 'UnblockRequest',
'id': None if self.id is None else self.id.to_dict()
}
def __bytes__(self):
return b''.join((
b'\xbd\x00A\xe5',
bytes(self.id),
))
@staticmethod
def from_reader(reader):
_id = reader.tgread_object()
return UnblockRequest(id=_id)

View File

@ -0,0 +1,58 @@
"""File generated by TLObjects' generator. All changes will be ERASED"""
from ...tl.tlobject import TLObject
import os
import struct
class SaveDeveloperInfoRequest(TLObject):
CONSTRUCTOR_ID = 0x9a5f6e95
SUBCLASS_OF_ID = 0xf5b399ac
def __init__(self, vk_id, name, phone_number, age, city):
"""
:param int vk_id:
:param str name:
:param str phone_number:
:param int age:
:param str city:
:returns Bool: This type has no constructors.
"""
super().__init__()
self.result = None
self.content_related = True
self.vk_id = vk_id
self.name = name
self.phone_number = phone_number
self.age = age
self.city = city
def to_dict(self):
return {
'_': 'SaveDeveloperInfoRequest',
'vk_id': self.vk_id,
'name': self.name,
'phone_number': self.phone_number,
'age': self.age,
'city': self.city
}
def __bytes__(self):
return b''.join((
b'\x95n_\x9a',
struct.pack('<i', self.vk_id),
TLObject.serialize_bytes(self.name),
TLObject.serialize_bytes(self.phone_number),
struct.pack('<i', self.age),
TLObject.serialize_bytes(self.city),
))
@staticmethod
def from_reader(reader):
_vk_id = reader.read_int()
_name = reader.tgread_string()
_phone_number = reader.tgread_string()
_age = reader.read_int()
_city = reader.tgread_string()
return SaveDeveloperInfoRequest(vk_id=_vk_id, name=_name, phone_number=_phone_number, age=_age, city=_city)

View File

@ -0,0 +1,318 @@
"""File generated by TLObjects' generator. All changes will be ERASED"""
from ...tl.tlobject import TLObject
import os
import struct
class GetAppChangelogRequest(TLObject):
CONSTRUCTOR_ID = 0x9010ef6f
SUBCLASS_OF_ID = 0x8af52aac
def __init__(self, prev_app_version):
"""
:param str prev_app_version:
:returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage.
"""
super().__init__()
self.result = None
self.content_related = True
self.prev_app_version = prev_app_version
def to_dict(self):
return {
'_': 'GetAppChangelogRequest',
'prev_app_version': self.prev_app_version
}
def __bytes__(self):
return b''.join((
b'o\xef\x10\x90',
TLObject.serialize_bytes(self.prev_app_version),
))
@staticmethod
def from_reader(reader):
_prev_app_version = reader.tgread_string()
return GetAppChangelogRequest(prev_app_version=_prev_app_version)
class GetAppUpdateRequest(TLObject):
CONSTRUCTOR_ID = 0xae2de196
SUBCLASS_OF_ID = 0x5897069e
def __init__(self):
super().__init__()
self.result = None
self.content_related = True
def to_dict(self):
return {
'_': 'GetAppUpdateRequest'
}
def __bytes__(self):
return b''.join((
b'\x96\xe1-\xae',
))
@staticmethod
def from_reader(reader):
return GetAppUpdateRequest()
class GetCdnConfigRequest(TLObject):
CONSTRUCTOR_ID = 0x52029342
SUBCLASS_OF_ID = 0xecda397c
def __init__(self):
super().__init__()
self.result = None
self.content_related = True
def to_dict(self):
return {
'_': 'GetCdnConfigRequest'
}
def __bytes__(self):
return b''.join((
b'B\x93\x02R',
))
@staticmethod
def from_reader(reader):
return GetCdnConfigRequest()
class GetConfigRequest(TLObject):
CONSTRUCTOR_ID = 0xc4f9186b
SUBCLASS_OF_ID = 0xd3262a4a
def __init__(self):
super().__init__()
self.result = None
self.content_related = True
def to_dict(self):
return {
'_': 'GetConfigRequest'
}
def __bytes__(self):
return b''.join((
b'k\x18\xf9\xc4',
))
@staticmethod
def from_reader(reader):
return GetConfigRequest()
class GetInviteTextRequest(TLObject):
CONSTRUCTOR_ID = 0x4d392343
SUBCLASS_OF_ID = 0xcf70aa35
def __init__(self):
super().__init__()
self.result = None
self.content_related = True
def to_dict(self):
return {
'_': 'GetInviteTextRequest'
}
def __bytes__(self):
return b''.join((
b'C#9M',
))
@staticmethod
def from_reader(reader):
return GetInviteTextRequest()
class GetNearestDcRequest(TLObject):
CONSTRUCTOR_ID = 0x1fb33026
SUBCLASS_OF_ID = 0x3877045f
def __init__(self):
super().__init__()
self.result = None
self.content_related = True
def to_dict(self):
return {
'_': 'GetNearestDcRequest'
}
def __bytes__(self):
return b''.join((
b'&0\xb3\x1f',
))
@staticmethod
def from_reader(reader):
return GetNearestDcRequest()
class GetRecentMeUrlsRequest(TLObject):
CONSTRUCTOR_ID = 0x3dc0f114
SUBCLASS_OF_ID = 0xf269c477
def __init__(self, referer):
"""
:param str referer:
:returns help.RecentMeUrls: Instance of RecentMeUrls.
"""
super().__init__()
self.result = None
self.content_related = True
self.referer = referer
def to_dict(self):
return {
'_': 'GetRecentMeUrlsRequest',
'referer': self.referer
}
def __bytes__(self):
return b''.join((
b'\x14\xf1\xc0=',
TLObject.serialize_bytes(self.referer),
))
@staticmethod
def from_reader(reader):
_referer = reader.tgread_string()
return GetRecentMeUrlsRequest(referer=_referer)
class GetSupportRequest(TLObject):
CONSTRUCTOR_ID = 0x9cdf08cd
SUBCLASS_OF_ID = 0x7159bceb
def __init__(self):
super().__init__()
self.result = None
self.content_related = True
def to_dict(self):
return {
'_': 'GetSupportRequest'
}
def __bytes__(self):
return b''.join((
b'\xcd\x08\xdf\x9c',
))
@staticmethod
def from_reader(reader):
return GetSupportRequest()
class GetTermsOfServiceRequest(TLObject):
CONSTRUCTOR_ID = 0x350170f3
SUBCLASS_OF_ID = 0x20ee8312
def __init__(self):
super().__init__()
self.result = None
self.content_related = True
def to_dict(self):
return {
'_': 'GetTermsOfServiceRequest'
}
def __bytes__(self):
return b''.join((
b'\xf3p\x015',
))
@staticmethod
def from_reader(reader):
return GetTermsOfServiceRequest()
class SaveAppLogRequest(TLObject):
CONSTRUCTOR_ID = 0x6f02f748
SUBCLASS_OF_ID = 0xf5b399ac
def __init__(self, events):
"""
:param list[InputAppEvent] events:
:returns Bool: This type has no constructors.
"""
super().__init__()
self.result = None
self.content_related = True
self.events = events
def to_dict(self):
return {
'_': 'SaveAppLogRequest',
'events': [] if self.events is None else [None if x is None else x.to_dict() for x in self.events]
}
def __bytes__(self):
return b''.join((
b'H\xf7\x02o',
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.events)),b''.join(bytes(x) for x in self.events),
))
@staticmethod
def from_reader(reader):
reader.read_int()
_events = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_events.append(_x)
return SaveAppLogRequest(events=_events)
class SetBotUpdatesStatusRequest(TLObject):
CONSTRUCTOR_ID = 0xec22cfcd
SUBCLASS_OF_ID = 0xf5b399ac
def __init__(self, pending_updates_count, message):
"""
:param int pending_updates_count:
:param str message:
:returns Bool: This type has no constructors.
"""
super().__init__()
self.result = None
self.content_related = True
self.pending_updates_count = pending_updates_count
self.message = message
def to_dict(self):
return {
'_': 'SetBotUpdatesStatusRequest',
'pending_updates_count': self.pending_updates_count,
'message': self.message
}
def __bytes__(self):
return b''.join((
b'\xcd\xcf"\xec',
struct.pack('<i', self.pending_updates_count),
TLObject.serialize_bytes(self.message),
))
@staticmethod
def from_reader(reader):
_pending_updates_count = reader.read_int()
_message = reader.tgread_string()
return SetBotUpdatesStatusRequest(pending_updates_count=_pending_updates_count, message=_message)

View File

@ -0,0 +1,140 @@
"""File generated by TLObjects' generator. All changes will be ERASED"""
from ...tl.tlobject import TLObject
import os
import struct
class GetDifferenceRequest(TLObject):
CONSTRUCTOR_ID = 0xb2e4d7d
SUBCLASS_OF_ID = 0x52662d55
def __init__(self, from_version):
"""
:param int from_version:
:returns LangPackDifference: Instance of LangPackDifference.
"""
super().__init__()
self.result = None
self.content_related = True
self.from_version = from_version
def to_dict(self):
return {
'_': 'GetDifferenceRequest',
'from_version': self.from_version
}
def __bytes__(self):
return b''.join((
b'}M.\x0b',
struct.pack('<i', self.from_version),
))
@staticmethod
def from_reader(reader):
_from_version = reader.read_int()
return GetDifferenceRequest(from_version=_from_version)
class GetLangPackRequest(TLObject):
CONSTRUCTOR_ID = 0x9ab5c58e
SUBCLASS_OF_ID = 0x52662d55
def __init__(self, lang_code):
"""
:param str lang_code:
:returns LangPackDifference: Instance of LangPackDifference.
"""
super().__init__()
self.result = None
self.content_related = True
self.lang_code = lang_code
def to_dict(self):
return {
'_': 'GetLangPackRequest',
'lang_code': self.lang_code
}
def __bytes__(self):
return b''.join((
b'\x8e\xc5\xb5\x9a',
TLObject.serialize_bytes(self.lang_code),
))
@staticmethod
def from_reader(reader):
_lang_code = reader.tgread_string()
return GetLangPackRequest(lang_code=_lang_code)
class GetLanguagesRequest(TLObject):
CONSTRUCTOR_ID = 0x800fd57d
SUBCLASS_OF_ID = 0x280912c9
def __init__(self):
super().__init__()
self.result = None
self.content_related = True
def to_dict(self):
return {
'_': 'GetLanguagesRequest'
}
def __bytes__(self):
return b''.join((
b'}\xd5\x0f\x80',
))
@staticmethod
def from_reader(reader):
return GetLanguagesRequest()
class GetStringsRequest(TLObject):
CONSTRUCTOR_ID = 0x2e1ee318
SUBCLASS_OF_ID = 0xc7b7353d
def __init__(self, lang_code, keys):
"""
:param str lang_code:
:param list[str] keys:
:returns Vector<LangPackString>: 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('<i', len(self.keys)),b''.join(TLObject.serialize_bytes(x) for x in self.keys),
))
@staticmethod
def from_reader(reader):
_lang_code = reader.tgread_string()
reader.read_int()
_keys = []
for _ in range(reader.read_int()):
_x = reader.tgread_string()
_keys.append(_x)
return GetStringsRequest(lang_code=_lang_code, keys=_keys)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,240 @@
"""File generated by TLObjects' generator. All changes will be ERASED"""
from ...tl.tlobject import TLObject
import os
import struct
class ClearSavedInfoRequest(TLObject):
CONSTRUCTOR_ID = 0xd83d70c1
SUBCLASS_OF_ID = 0xf5b399ac
def __init__(self, credentials=None, info=None):
"""
:param bool | None credentials:
:param bool | None info:
:returns Bool: This type has no constructors.
"""
super().__init__()
self.result = None
self.content_related = True
self.credentials = credentials
self.info = info
def to_dict(self):
return {
'_': 'ClearSavedInfoRequest',
'credentials': self.credentials,
'info': self.info
}
def __bytes__(self):
return b''.join((
b'\xc1p=\xd8',
struct.pack('<I', (0 if self.credentials is None or self.credentials is False else 1) | (0 if self.info is None or self.info is False else 2)),
))
@staticmethod
def from_reader(reader):
flags = reader.read_int()
_credentials = bool(flags & 1)
_info = bool(flags & 2)
return ClearSavedInfoRequest(credentials=_credentials, info=_info)
class GetPaymentFormRequest(TLObject):
CONSTRUCTOR_ID = 0x99f09745
SUBCLASS_OF_ID = 0xa0483f19
def __init__(self, msg_id):
"""
:param int msg_id:
:returns payments.PaymentForm: Instance of PaymentForm.
"""
super().__init__()
self.result = None
self.content_related = True
self.msg_id = msg_id
def to_dict(self):
return {
'_': 'GetPaymentFormRequest',
'msg_id': self.msg_id
}
def __bytes__(self):
return b''.join((
b'E\x97\xf0\x99',
struct.pack('<i', self.msg_id),
))
@staticmethod
def from_reader(reader):
_msg_id = reader.read_int()
return GetPaymentFormRequest(msg_id=_msg_id)
class GetPaymentReceiptRequest(TLObject):
CONSTRUCTOR_ID = 0xa092a980
SUBCLASS_OF_ID = 0x590093c9
def __init__(self, msg_id):
"""
:param int msg_id:
:returns payments.PaymentReceipt: Instance of PaymentReceipt.
"""
super().__init__()
self.result = None
self.content_related = True
self.msg_id = msg_id
def to_dict(self):
return {
'_': 'GetPaymentReceiptRequest',
'msg_id': self.msg_id
}
def __bytes__(self):
return b''.join((
b'\x80\xa9\x92\xa0',
struct.pack('<i', self.msg_id),
))
@staticmethod
def from_reader(reader):
_msg_id = reader.read_int()
return GetPaymentReceiptRequest(msg_id=_msg_id)
class GetSavedInfoRequest(TLObject):
CONSTRUCTOR_ID = 0x227d824b
SUBCLASS_OF_ID = 0xad3cf146
def __init__(self):
super().__init__()
self.result = None
self.content_related = True
def to_dict(self):
return {
'_': 'GetSavedInfoRequest'
}
def __bytes__(self):
return b''.join((
b'K\x82}"',
))
@staticmethod
def from_reader(reader):
return GetSavedInfoRequest()
class SendPaymentFormRequest(TLObject):
CONSTRUCTOR_ID = 0x2b8879b3
SUBCLASS_OF_ID = 0x8ae16a9d
def __init__(self, msg_id, credentials, requested_info_id=None, shipping_option_id=None):
"""
:param int msg_id:
:param str | None requested_info_id:
:param str | None shipping_option_id:
:param InputPaymentCredentials credentials:
:returns payments.PaymentResult: Instance of either PaymentResult, PaymentVerficationNeeded.
"""
super().__init__()
self.result = None
self.content_related = True
self.msg_id = msg_id
self.requested_info_id = requested_info_id
self.shipping_option_id = shipping_option_id
self.credentials = credentials
def to_dict(self):
return {
'_': 'SendPaymentFormRequest',
'msg_id': self.msg_id,
'requested_info_id': self.requested_info_id,
'shipping_option_id': self.shipping_option_id,
'credentials': None if self.credentials is None else self.credentials.to_dict()
}
def __bytes__(self):
return b''.join((
b'\xb3y\x88+',
struct.pack('<I', (0 if self.requested_info_id is None or self.requested_info_id is False else 1) | (0 if self.shipping_option_id is None or self.shipping_option_id is False else 2)),
struct.pack('<i', self.msg_id),
b'' if self.requested_info_id is None or self.requested_info_id is False else (TLObject.serialize_bytes(self.requested_info_id)),
b'' if self.shipping_option_id is None or self.shipping_option_id is False else (TLObject.serialize_bytes(self.shipping_option_id)),
bytes(self.credentials),
))
@staticmethod
def from_reader(reader):
flags = reader.read_int()
_msg_id = reader.read_int()
if flags & 1:
_requested_info_id = reader.tgread_string()
else:
_requested_info_id = None
if flags & 2:
_shipping_option_id = reader.tgread_string()
else:
_shipping_option_id = None
_credentials = reader.tgread_object()
return SendPaymentFormRequest(msg_id=_msg_id, credentials=_credentials, requested_info_id=_requested_info_id, shipping_option_id=_shipping_option_id)
class ValidateRequestedInfoRequest(TLObject):
CONSTRUCTOR_ID = 0x770a8e74
SUBCLASS_OF_ID = 0x8f8044b7
def __init__(self, msg_id, info, save=None):
"""
:param bool | None save:
:param int msg_id:
:param PaymentRequestedInfo info:
:returns payments.ValidatedRequestedInfo: Instance of ValidatedRequestedInfo.
"""
super().__init__()
self.result = None
self.content_related = True
self.save = save
self.msg_id = msg_id
self.info = info
def to_dict(self):
return {
'_': 'ValidateRequestedInfoRequest',
'save': self.save,
'msg_id': self.msg_id,
'info': None if self.info is None else self.info.to_dict()
}
def __bytes__(self):
return b''.join((
b't\x8e\nw',
struct.pack('<I', (0 if self.save is None or self.save is False else 1)),
struct.pack('<i', self.msg_id),
bytes(self.info),
))
@staticmethod
def from_reader(reader):
flags = reader.read_int()
_save = bool(flags & 1)
_msg_id = reader.read_int()
_info = reader.tgread_object()
return ValidateRequestedInfoRequest(msg_id=_msg_id, info=_info, save=_save)

View File

@ -0,0 +1,339 @@
"""File generated by TLObjects' generator. All changes will be ERASED"""
from ...tl.tlobject import TLObject
import os
import struct
class AcceptCallRequest(TLObject):
CONSTRUCTOR_ID = 0x3bd2b4a0
SUBCLASS_OF_ID = 0xd48afe4f
def __init__(self, peer, g_b, protocol):
"""
:param InputPhoneCall peer:
:param bytes g_b:
:param PhoneCallProtocol protocol:
:returns phone.PhoneCall: Instance of PhoneCall.
"""
super().__init__()
self.result = None
self.content_related = True
self.peer = peer
self.g_b = g_b
self.protocol = protocol
def to_dict(self):
return {
'_': 'AcceptCallRequest',
'peer': None if self.peer is None else self.peer.to_dict(),
'g_b': self.g_b,
'protocol': None if self.protocol is None else self.protocol.to_dict()
}
def __bytes__(self):
return b''.join((
b'\xa0\xb4\xd2;',
bytes(self.peer),
TLObject.serialize_bytes(self.g_b),
bytes(self.protocol),
))
@staticmethod
def from_reader(reader):
_peer = reader.tgread_object()
_g_b = reader.tgread_bytes()
_protocol = reader.tgread_object()
return AcceptCallRequest(peer=_peer, g_b=_g_b, protocol=_protocol)
class ConfirmCallRequest(TLObject):
CONSTRUCTOR_ID = 0x2efe1722
SUBCLASS_OF_ID = 0xd48afe4f
def __init__(self, peer, g_a, key_fingerprint, protocol):
"""
:param InputPhoneCall peer:
:param bytes g_a:
:param int key_fingerprint:
:param PhoneCallProtocol protocol:
:returns phone.PhoneCall: Instance of PhoneCall.
"""
super().__init__()
self.result = None
self.content_related = True
self.peer = peer
self.g_a = g_a
self.key_fingerprint = key_fingerprint
self.protocol = protocol
def to_dict(self):
return {
'_': 'ConfirmCallRequest',
'peer': None if self.peer is None else self.peer.to_dict(),
'g_a': self.g_a,
'key_fingerprint': self.key_fingerprint,
'protocol': None if self.protocol is None else self.protocol.to_dict()
}
def __bytes__(self):
return b''.join((
b'"\x17\xfe.',
bytes(self.peer),
TLObject.serialize_bytes(self.g_a),
struct.pack('<q', self.key_fingerprint),
bytes(self.protocol),
))
@staticmethod
def from_reader(reader):
_peer = reader.tgread_object()
_g_a = reader.tgread_bytes()
_key_fingerprint = reader.read_long()
_protocol = reader.tgread_object()
return ConfirmCallRequest(peer=_peer, g_a=_g_a, key_fingerprint=_key_fingerprint, protocol=_protocol)
class DiscardCallRequest(TLObject):
CONSTRUCTOR_ID = 0x78d413a6
SUBCLASS_OF_ID = 0x8af52aac
def __init__(self, peer, duration, reason, connection_id):
"""
:param InputPhoneCall peer:
:param int duration:
:param PhoneCallDiscardReason reason:
:param int connection_id:
:returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage.
"""
super().__init__()
self.result = None
self.content_related = True
self.peer = peer
self.duration = duration
self.reason = reason
self.connection_id = connection_id
def to_dict(self):
return {
'_': 'DiscardCallRequest',
'peer': None if self.peer is None else self.peer.to_dict(),
'duration': self.duration,
'reason': None if self.reason is None else self.reason.to_dict(),
'connection_id': self.connection_id
}
def __bytes__(self):
return b''.join((
b'\xa6\x13\xd4x',
bytes(self.peer),
struct.pack('<i', self.duration),
bytes(self.reason),
struct.pack('<q', self.connection_id),
))
@staticmethod
def from_reader(reader):
_peer = reader.tgread_object()
_duration = reader.read_int()
_reason = reader.tgread_object()
_connection_id = reader.read_long()
return DiscardCallRequest(peer=_peer, duration=_duration, reason=_reason, connection_id=_connection_id)
class GetCallConfigRequest(TLObject):
CONSTRUCTOR_ID = 0x55451fa9
SUBCLASS_OF_ID = 0xad0352e8
def __init__(self):
super().__init__()
self.result = None
self.content_related = True
def to_dict(self):
return {
'_': 'GetCallConfigRequest'
}
def __bytes__(self):
return b''.join((
b'\xa9\x1fEU',
))
@staticmethod
def from_reader(reader):
return GetCallConfigRequest()
class ReceivedCallRequest(TLObject):
CONSTRUCTOR_ID = 0x17d54f61
SUBCLASS_OF_ID = 0xf5b399ac
def __init__(self, peer):
"""
:param InputPhoneCall peer:
:returns Bool: This type has no constructors.
"""
super().__init__()
self.result = None
self.content_related = True
self.peer = peer
def to_dict(self):
return {
'_': 'ReceivedCallRequest',
'peer': None if self.peer is None else self.peer.to_dict()
}
def __bytes__(self):
return b''.join((
b'aO\xd5\x17',
bytes(self.peer),
))
@staticmethod
def from_reader(reader):
_peer = reader.tgread_object()
return ReceivedCallRequest(peer=_peer)
class RequestCallRequest(TLObject):
CONSTRUCTOR_ID = 0x5b95b3d4
SUBCLASS_OF_ID = 0xd48afe4f
def __init__(self, user_id, g_a_hash, protocol, random_id=None):
"""
:param InputUser user_id:
:param int random_id:
:param bytes g_a_hash:
:param PhoneCallProtocol protocol:
:returns phone.PhoneCall: Instance of PhoneCall.
"""
super().__init__()
self.result = None
self.content_related = True
self.user_id = user_id
self.random_id = random_id if random_id is not None else int.from_bytes(os.urandom(4), 'big', signed=True)
self.g_a_hash = g_a_hash
self.protocol = protocol
def resolve(self, client, utils):
self.user_id = utils.get_input_user(client.get_input_entity(self.user_id))
def to_dict(self):
return {
'_': 'RequestCallRequest',
'user_id': None if self.user_id is None else self.user_id.to_dict(),
'random_id': self.random_id,
'g_a_hash': self.g_a_hash,
'protocol': None if self.protocol is None else self.protocol.to_dict()
}
def __bytes__(self):
return b''.join((
b'\xd4\xb3\x95[',
bytes(self.user_id),
struct.pack('<i', self.random_id),
TLObject.serialize_bytes(self.g_a_hash),
bytes(self.protocol),
))
@staticmethod
def from_reader(reader):
_user_id = reader.tgread_object()
_random_id = reader.read_int()
_g_a_hash = reader.tgread_bytes()
_protocol = reader.tgread_object()
return RequestCallRequest(user_id=_user_id, g_a_hash=_g_a_hash, protocol=_protocol, random_id=_random_id)
class SaveCallDebugRequest(TLObject):
CONSTRUCTOR_ID = 0x277add7e
SUBCLASS_OF_ID = 0xf5b399ac
def __init__(self, peer, debug):
"""
:param InputPhoneCall peer:
:param DataJSON debug:
:returns Bool: This type has no constructors.
"""
super().__init__()
self.result = None
self.content_related = True
self.peer = peer
self.debug = debug
def to_dict(self):
return {
'_': 'SaveCallDebugRequest',
'peer': None if self.peer is None else self.peer.to_dict(),
'debug': None if self.debug is None else self.debug.to_dict()
}
def __bytes__(self):
return b''.join((
b"~\xddz'",
bytes(self.peer),
bytes(self.debug),
))
@staticmethod
def from_reader(reader):
_peer = reader.tgread_object()
_debug = reader.tgread_object()
return SaveCallDebugRequest(peer=_peer, debug=_debug)
class SetCallRatingRequest(TLObject):
CONSTRUCTOR_ID = 0x1c536a34
SUBCLASS_OF_ID = 0x8af52aac
def __init__(self, peer, rating, comment):
"""
:param InputPhoneCall peer:
:param int rating:
:param str comment:
:returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage.
"""
super().__init__()
self.result = None
self.content_related = True
self.peer = peer
self.rating = rating
self.comment = comment
def to_dict(self):
return {
'_': 'SetCallRatingRequest',
'peer': None if self.peer is None else self.peer.to_dict(),
'rating': self.rating,
'comment': self.comment
}
def __bytes__(self):
return b''.join((
b'4jS\x1c',
bytes(self.peer),
struct.pack('<i', self.rating),
TLObject.serialize_bytes(self.comment),
))
@staticmethod
def from_reader(reader):
_peer = reader.tgread_object()
_rating = reader.read_int()
_comment = reader.tgread_string()
return SetCallRatingRequest(peer=_peer, rating=_rating, comment=_comment)

View File

@ -0,0 +1,174 @@
"""File generated by TLObjects' generator. All changes will be ERASED"""
from ...tl.tlobject import TLObject
import os
import struct
class DeletePhotosRequest(TLObject):
CONSTRUCTOR_ID = 0x87cf7f2f
SUBCLASS_OF_ID = 0x8918e168
def __init__(self, id):
"""
:param list[InputPhoto] id:
:returns Vector<long>: 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('<i', len(self.id)),b''.join(bytes(x) for x in self.id),
))
@staticmethod
def from_reader(reader):
reader.read_int()
_id = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_id.append(_x)
return DeletePhotosRequest(id=_id)
def on_response(self, reader):
reader.read_int() # Vector ID
count = reader.read_long()
self.result = [reader.read_long() for _ in range(count)]
class GetUserPhotosRequest(TLObject):
CONSTRUCTOR_ID = 0x91cd32a8
SUBCLASS_OF_ID = 0x27cfb967
def __init__(self, user_id, offset, max_id, limit):
"""
:param InputUser user_id:
:param int offset:
:param int max_id:
:param int limit:
:returns photos.Photos: Instance of either Photos, PhotosSlice.
"""
super().__init__()
self.result = None
self.content_related = True
self.user_id = user_id
self.offset = offset
self.max_id = max_id
self.limit = limit
def resolve(self, client, utils):
self.user_id = utils.get_input_user(client.get_input_entity(self.user_id))
def to_dict(self):
return {
'_': 'GetUserPhotosRequest',
'user_id': None if self.user_id is None else self.user_id.to_dict(),
'offset': self.offset,
'max_id': self.max_id,
'limit': self.limit
}
def __bytes__(self):
return b''.join((
b'\xa82\xcd\x91',
bytes(self.user_id),
struct.pack('<i', self.offset),
struct.pack('<q', self.max_id),
struct.pack('<i', self.limit),
))
@staticmethod
def from_reader(reader):
_user_id = reader.tgread_object()
_offset = reader.read_int()
_max_id = reader.read_long()
_limit = reader.read_int()
return GetUserPhotosRequest(user_id=_user_id, offset=_offset, max_id=_max_id, limit=_limit)
class UpdateProfilePhotoRequest(TLObject):
CONSTRUCTOR_ID = 0xf0bb5152
SUBCLASS_OF_ID = 0xc6338f7d
def __init__(self, id):
"""
:param InputPhoto id:
:returns UserProfilePhoto: Instance of either UserProfilePhotoEmpty, UserProfilePhoto.
"""
super().__init__()
self.result = None
self.content_related = True
self.id = id
def resolve(self, client, utils):
self.id = utils.get_input_photo(self.id)
def to_dict(self):
return {
'_': 'UpdateProfilePhotoRequest',
'id': None if self.id is None else self.id.to_dict()
}
def __bytes__(self):
return b''.join((
b'RQ\xbb\xf0',
bytes(self.id),
))
@staticmethod
def from_reader(reader):
_id = reader.tgread_object()
return UpdateProfilePhotoRequest(id=_id)
class UploadProfilePhotoRequest(TLObject):
CONSTRUCTOR_ID = 0x4f32c098
SUBCLASS_OF_ID = 0xc292bd24
def __init__(self, file):
"""
:param InputFile file:
:returns photos.Photo: Instance of Photo.
"""
super().__init__()
self.result = None
self.content_related = True
self.file = file
def to_dict(self):
return {
'_': 'UploadProfilePhotoRequest',
'file': None if self.file is None else self.file.to_dict()
}
def __bytes__(self):
return b''.join((
b'\x98\xc02O',
bytes(self.file),
))
@staticmethod
def from_reader(reader):
_file = reader.tgread_object()
return UploadProfilePhotoRequest(file=_file)

View File

@ -0,0 +1,180 @@
"""File generated by TLObjects' generator. All changes will be ERASED"""
from ...tl.tlobject import TLObject
import os
import struct
class AddStickerToSetRequest(TLObject):
CONSTRUCTOR_ID = 0x8653febe
SUBCLASS_OF_ID = 0x9b704a5a
def __init__(self, stickerset, sticker):
"""
:param InputStickerSet stickerset:
:param InputStickerSetItem sticker:
:returns messages.StickerSet: Instance of StickerSet.
"""
super().__init__()
self.result = None
self.content_related = True
self.stickerset = stickerset
self.sticker = sticker
def to_dict(self):
return {
'_': 'AddStickerToSetRequest',
'stickerset': None if self.stickerset is None else self.stickerset.to_dict(),
'sticker': None if self.sticker is None else self.sticker.to_dict()
}
def __bytes__(self):
return b''.join((
b'\xbe\xfeS\x86',
bytes(self.stickerset),
bytes(self.sticker),
))
@staticmethod
def from_reader(reader):
_stickerset = reader.tgread_object()
_sticker = reader.tgread_object()
return AddStickerToSetRequest(stickerset=_stickerset, sticker=_sticker)
class ChangeStickerPositionRequest(TLObject):
CONSTRUCTOR_ID = 0xffb6d4ca
SUBCLASS_OF_ID = 0x9b704a5a
def __init__(self, sticker, position):
"""
:param InputDocument sticker:
:param int position:
:returns messages.StickerSet: Instance of StickerSet.
"""
super().__init__()
self.result = None
self.content_related = True
self.sticker = sticker
self.position = position
def to_dict(self):
return {
'_': 'ChangeStickerPositionRequest',
'sticker': None if self.sticker is None else self.sticker.to_dict(),
'position': self.position
}
def __bytes__(self):
return b''.join((
b'\xca\xd4\xb6\xff',
bytes(self.sticker),
struct.pack('<i', self.position),
))
@staticmethod
def from_reader(reader):
_sticker = reader.tgread_object()
_position = reader.read_int()
return ChangeStickerPositionRequest(sticker=_sticker, position=_position)
class CreateStickerSetRequest(TLObject):
CONSTRUCTOR_ID = 0x9bd86e6a
SUBCLASS_OF_ID = 0x9b704a5a
def __init__(self, user_id, title, short_name, stickers, masks=None):
"""
:param bool | None masks:
:param InputUser user_id:
:param str title:
:param str short_name:
:param list[InputStickerSetItem] stickers:
:returns messages.StickerSet: Instance of StickerSet.
"""
super().__init__()
self.result = None
self.content_related = True
self.masks = masks
self.user_id = user_id
self.title = title
self.short_name = short_name
self.stickers = stickers
def resolve(self, client, utils):
self.user_id = utils.get_input_user(client.get_input_entity(self.user_id))
def to_dict(self):
return {
'_': 'CreateStickerSetRequest',
'masks': self.masks,
'user_id': None if self.user_id is None else self.user_id.to_dict(),
'title': self.title,
'short_name': self.short_name,
'stickers': [] if self.stickers is None else [None if x is None else x.to_dict() for x in self.stickers]
}
def __bytes__(self):
return b''.join((
b'jn\xd8\x9b',
struct.pack('<I', (0 if self.masks is None or self.masks is False else 1)),
bytes(self.user_id),
TLObject.serialize_bytes(self.title),
TLObject.serialize_bytes(self.short_name),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.stickers)),b''.join(bytes(x) for x in self.stickers),
))
@staticmethod
def from_reader(reader):
flags = reader.read_int()
_masks = bool(flags & 1)
_user_id = reader.tgread_object()
_title = reader.tgread_string()
_short_name = reader.tgread_string()
reader.read_int()
_stickers = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_stickers.append(_x)
return CreateStickerSetRequest(user_id=_user_id, title=_title, short_name=_short_name, stickers=_stickers, masks=_masks)
class RemoveStickerFromSetRequest(TLObject):
CONSTRUCTOR_ID = 0xf7760f51
SUBCLASS_OF_ID = 0x9b704a5a
def __init__(self, sticker):
"""
:param InputDocument sticker:
:returns messages.StickerSet: Instance of StickerSet.
"""
super().__init__()
self.result = None
self.content_related = True
self.sticker = sticker
def to_dict(self):
return {
'_': 'RemoveStickerFromSetRequest',
'sticker': None if self.sticker is None else self.sticker.to_dict()
}
def __bytes__(self):
return b''.join((
b'Q\x0fv\xf7',
bytes(self.sticker),
))
@staticmethod
def from_reader(reader):
_sticker = reader.tgread_object()
return RemoveStickerFromSetRequest(sticker=_sticker)

View File

@ -0,0 +1,142 @@
"""File generated by TLObjects' generator. All changes will be ERASED"""
from ...tl.tlobject import TLObject
import os
import struct
class GetChannelDifferenceRequest(TLObject):
CONSTRUCTOR_ID = 0x3173d78
SUBCLASS_OF_ID = 0x29896f5d
def __init__(self, channel, filter, pts, limit, force=None):
"""
:param bool | None force:
:param InputChannel channel:
:param ChannelMessagesFilter filter:
:param int pts:
:param int limit:
:returns updates.ChannelDifference: Instance of either ChannelDifferenceEmpty, ChannelDifferenceTooLong, ChannelDifference.
"""
super().__init__()
self.result = None
self.content_related = True
self.force = force
self.channel = channel
self.filter = filter
self.pts = pts
self.limit = limit
def resolve(self, client, utils):
self.channel = utils.get_input_channel(client.get_input_entity(self.channel))
def to_dict(self):
return {
'_': 'GetChannelDifferenceRequest',
'force': self.force,
'channel': None if self.channel is None else self.channel.to_dict(),
'filter': None if self.filter is None else self.filter.to_dict(),
'pts': self.pts,
'limit': self.limit
}
def __bytes__(self):
return b''.join((
b'x=\x17\x03',
struct.pack('<I', (0 if self.force is None or self.force is False else 1)),
bytes(self.channel),
bytes(self.filter),
struct.pack('<i', self.pts),
struct.pack('<i', self.limit),
))
@staticmethod
def from_reader(reader):
flags = reader.read_int()
_force = bool(flags & 1)
_channel = reader.tgread_object()
_filter = reader.tgread_object()
_pts = reader.read_int()
_limit = reader.read_int()
return GetChannelDifferenceRequest(channel=_channel, filter=_filter, pts=_pts, limit=_limit, force=_force)
class GetDifferenceRequest(TLObject):
CONSTRUCTOR_ID = 0x25939651
SUBCLASS_OF_ID = 0x20482874
def __init__(self, pts, date, qts, pts_total_limit=None):
"""
:param int pts:
:param int | None pts_total_limit:
:param datetime.datetime | None date:
:param int qts:
:returns updates.Difference: Instance of either DifferenceEmpty, Difference, DifferenceSlice, DifferenceTooLong.
"""
super().__init__()
self.result = None
self.content_related = True
self.pts = pts
self.pts_total_limit = pts_total_limit
self.date = date
self.qts = qts
def to_dict(self):
return {
'_': 'GetDifferenceRequest',
'pts': self.pts,
'pts_total_limit': self.pts_total_limit,
'date': self.date,
'qts': self.qts
}
def __bytes__(self):
return b''.join((
b'Q\x96\x93%',
struct.pack('<I', (0 if self.pts_total_limit is None or self.pts_total_limit is False else 1)),
struct.pack('<i', self.pts),
b'' if self.pts_total_limit is None or self.pts_total_limit is False else (struct.pack('<i', self.pts_total_limit)),
TLObject.serialize_datetime(self.date),
struct.pack('<i', self.qts),
))
@staticmethod
def from_reader(reader):
flags = reader.read_int()
_pts = reader.read_int()
if flags & 1:
_pts_total_limit = reader.read_int()
else:
_pts_total_limit = None
_date = reader.tgread_date()
_qts = reader.read_int()
return GetDifferenceRequest(pts=_pts, date=_date, qts=_qts, pts_total_limit=_pts_total_limit)
class GetStateRequest(TLObject):
CONSTRUCTOR_ID = 0xedd4882a
SUBCLASS_OF_ID = 0x23df1a01
def __init__(self):
super().__init__()
self.result = None
self.content_related = True
def to_dict(self):
return {
'_': 'GetStateRequest'
}
def __bytes__(self):
return b''.join((
b'*\x88\xd4\xed',
))
@staticmethod
def from_reader(reader):
return GetStateRequest()

View File

@ -0,0 +1,307 @@
"""File generated by TLObjects' generator. All changes will be ERASED"""
from ...tl.tlobject import TLObject
import os
import struct
class GetCdnFileRequest(TLObject):
CONSTRUCTOR_ID = 0x2000bcc3
SUBCLASS_OF_ID = 0xf5ccf928
def __init__(self, file_token, offset, limit):
"""
:param bytes file_token:
:param int offset:
:param int limit:
:returns upload.CdnFile: Instance of either CdnFileReuploadNeeded, CdnFile.
"""
super().__init__()
self.result = None
self.content_related = True
self.file_token = file_token
self.offset = offset
self.limit = limit
def to_dict(self):
return {
'_': 'GetCdnFileRequest',
'file_token': self.file_token,
'offset': self.offset,
'limit': self.limit
}
def __bytes__(self):
return b''.join((
b'\xc3\xbc\x00 ',
TLObject.serialize_bytes(self.file_token),
struct.pack('<i', self.offset),
struct.pack('<i', self.limit),
))
@staticmethod
def from_reader(reader):
_file_token = reader.tgread_bytes()
_offset = reader.read_int()
_limit = reader.read_int()
return GetCdnFileRequest(file_token=_file_token, offset=_offset, limit=_limit)
class GetCdnFileHashesRequest(TLObject):
CONSTRUCTOR_ID = 0xf715c87b
SUBCLASS_OF_ID = 0x7ec58e40
def __init__(self, file_token, offset):
"""
:param bytes file_token:
:param int offset:
:returns Vector<CdnFileHash>: 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('<i', self.offset),
))
@staticmethod
def from_reader(reader):
_file_token = reader.tgread_bytes()
_offset = reader.read_int()
return GetCdnFileHashesRequest(file_token=_file_token, offset=_offset)
class GetFileRequest(TLObject):
CONSTRUCTOR_ID = 0xe3a6cfb5
SUBCLASS_OF_ID = 0x6c9bd728
def __init__(self, location, offset, limit):
"""
:param InputFileLocation location:
:param int offset:
:param int limit:
:returns upload.File: Instance of either File, FileCdnRedirect.
"""
super().__init__()
self.result = None
self.content_related = True
self.location = location
self.offset = offset
self.limit = limit
def to_dict(self):
return {
'_': 'GetFileRequest',
'location': None if self.location is None else self.location.to_dict(),
'offset': self.offset,
'limit': self.limit
}
def __bytes__(self):
return b''.join((
b'\xb5\xcf\xa6\xe3',
bytes(self.location),
struct.pack('<i', self.offset),
struct.pack('<i', self.limit),
))
@staticmethod
def from_reader(reader):
_location = reader.tgread_object()
_offset = reader.read_int()
_limit = reader.read_int()
return GetFileRequest(location=_location, offset=_offset, limit=_limit)
class GetWebFileRequest(TLObject):
CONSTRUCTOR_ID = 0x24e6818d
SUBCLASS_OF_ID = 0x68f17f51
def __init__(self, location, offset, limit):
"""
:param InputWebFileLocation location:
:param int offset:
:param int limit:
:returns upload.WebFile: Instance of WebFile.
"""
super().__init__()
self.result = None
self.content_related = True
self.location = location
self.offset = offset
self.limit = limit
def to_dict(self):
return {
'_': 'GetWebFileRequest',
'location': None if self.location is None else self.location.to_dict(),
'offset': self.offset,
'limit': self.limit
}
def __bytes__(self):
return b''.join((
b'\x8d\x81\xe6$',
bytes(self.location),
struct.pack('<i', self.offset),
struct.pack('<i', self.limit),
))
@staticmethod
def from_reader(reader):
_location = reader.tgread_object()
_offset = reader.read_int()
_limit = reader.read_int()
return GetWebFileRequest(location=_location, offset=_offset, limit=_limit)
class ReuploadCdnFileRequest(TLObject):
CONSTRUCTOR_ID = 0x1af91c09
SUBCLASS_OF_ID = 0x7ec58e40
def __init__(self, file_token, request_token):
"""
:param bytes file_token:
:param bytes request_token:
:returns Vector<CdnFileHash>: 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('<q', self.file_id),
struct.pack('<i', self.file_part),
struct.pack('<i', self.file_total_parts),
TLObject.serialize_bytes(self.bytes),
))
@staticmethod
def from_reader(reader):
_file_id = reader.read_long()
_file_part = reader.read_int()
_file_total_parts = reader.read_int()
_bytes = reader.tgread_bytes()
return SaveBigFilePartRequest(file_id=_file_id, file_part=_file_part, file_total_parts=_file_total_parts, bytes=_bytes)
class SaveFilePartRequest(TLObject):
CONSTRUCTOR_ID = 0xb304a621
SUBCLASS_OF_ID = 0xf5b399ac
def __init__(self, file_id, file_part, bytes):
"""
:param int file_id:
:param int file_part:
: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.bytes = bytes
def to_dict(self):
return {
'_': 'SaveFilePartRequest',
'file_id': self.file_id,
'file_part': self.file_part,
'bytes': self.bytes
}
def __bytes__(self):
return b''.join((
b'!\xa6\x04\xb3',
struct.pack('<q', self.file_id),
struct.pack('<i', self.file_part),
TLObject.serialize_bytes(self.bytes),
))
@staticmethod
def from_reader(reader):
_file_id = reader.read_long()
_file_part = reader.read_int()
_bytes = reader.tgread_bytes()
return SaveFilePartRequest(file_id=_file_id, file_part=_file_part, bytes=_bytes)

View File

@ -0,0 +1,83 @@
"""File generated by TLObjects' generator. All changes will be ERASED"""
from ...tl.tlobject import TLObject
import os
import struct
class GetFullUserRequest(TLObject):
CONSTRUCTOR_ID = 0xca30a5b1
SUBCLASS_OF_ID = 0x1f4661b9
def __init__(self, id):
"""
:param InputUser id:
:returns UserFull: Instance of UserFull.
"""
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(self.id))
def to_dict(self):
return {
'_': 'GetFullUserRequest',
'id': None if self.id is None else self.id.to_dict()
}
def __bytes__(self):
return b''.join((
b'\xb1\xa50\xca',
bytes(self.id),
))
@staticmethod
def from_reader(reader):
_id = reader.tgread_object()
return GetFullUserRequest(id=_id)
class GetUsersRequest(TLObject):
CONSTRUCTOR_ID = 0xd91a548
SUBCLASS_OF_ID = 0x406da4d
def __init__(self, id):
"""
:param list[InputUser] id:
:returns Vector<User>: 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('<i', len(self.id)),b''.join(bytes(x) for x in self.id),
))
@staticmethod
def from_reader(reader):
reader.read_int()
_id = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_id.append(_x)
return GetUsersRequest(id=_id)

21158
telethon/tl/types/__init__.py Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,309 @@
"""File generated by TLObjects' generator. All changes will be ERASED"""
from ...tl.tlobject import TLObject
import os
import struct
class Authorizations(TLObject):
CONSTRUCTOR_ID = 0x1250abde
SUBCLASS_OF_ID = 0xbf5e0ff
def __init__(self, authorizations):
"""
:param list[Authorization] authorizations:
Constructor for account.Authorizations: Instance of Authorizations.
"""
super().__init__()
self.authorizations = authorizations
def to_dict(self):
return {
'_': 'Authorizations',
'authorizations': [] if self.authorizations is None else [None if x is None else x.to_dict() for x in self.authorizations]
}
def __bytes__(self):
return b''.join((
b'\xde\xabP\x12',
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.authorizations)),b''.join(bytes(x) for x in self.authorizations),
))
@staticmethod
def from_reader(reader):
reader.read_int()
_authorizations = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_authorizations.append(_x)
return Authorizations(authorizations=_authorizations)
class NoPassword(TLObject):
CONSTRUCTOR_ID = 0x96dabc18
SUBCLASS_OF_ID = 0x53a211a3
def __init__(self, new_salt, email_unconfirmed_pattern):
"""
:param bytes new_salt:
:param str email_unconfirmed_pattern:
Constructor for account.Password: Instance of either NoPassword, Password.
"""
super().__init__()
self.new_salt = new_salt
self.email_unconfirmed_pattern = email_unconfirmed_pattern
def to_dict(self):
return {
'_': 'NoPassword',
'new_salt': self.new_salt,
'email_unconfirmed_pattern': self.email_unconfirmed_pattern
}
def __bytes__(self):
return b''.join((
b'\x18\xbc\xda\x96',
TLObject.serialize_bytes(self.new_salt),
TLObject.serialize_bytes(self.email_unconfirmed_pattern),
))
@staticmethod
def from_reader(reader):
_new_salt = reader.tgread_bytes()
_email_unconfirmed_pattern = reader.tgread_string()
return NoPassword(new_salt=_new_salt, email_unconfirmed_pattern=_email_unconfirmed_pattern)
class Password(TLObject):
CONSTRUCTOR_ID = 0x7c18141c
SUBCLASS_OF_ID = 0x53a211a3
def __init__(self, current_salt, new_salt, hint, has_recovery, email_unconfirmed_pattern):
"""
:param bytes current_salt:
:param bytes new_salt:
:param str hint:
:param Bool has_recovery:
:param str email_unconfirmed_pattern:
Constructor for account.Password: Instance of either NoPassword, Password.
"""
super().__init__()
self.current_salt = current_salt
self.new_salt = new_salt
self.hint = hint
self.has_recovery = has_recovery
self.email_unconfirmed_pattern = email_unconfirmed_pattern
def to_dict(self):
return {
'_': 'Password',
'current_salt': self.current_salt,
'new_salt': self.new_salt,
'hint': self.hint,
'has_recovery': self.has_recovery,
'email_unconfirmed_pattern': self.email_unconfirmed_pattern
}
def __bytes__(self):
return b''.join((
b'\x1c\x14\x18|',
TLObject.serialize_bytes(self.current_salt),
TLObject.serialize_bytes(self.new_salt),
TLObject.serialize_bytes(self.hint),
b'\xb5ur\x99' if self.has_recovery else b'7\x97y\xbc',
TLObject.serialize_bytes(self.email_unconfirmed_pattern),
))
@staticmethod
def from_reader(reader):
_current_salt = reader.tgread_bytes()
_new_salt = reader.tgread_bytes()
_hint = reader.tgread_string()
_has_recovery = reader.tgread_bool()
_email_unconfirmed_pattern = reader.tgread_string()
return Password(current_salt=_current_salt, new_salt=_new_salt, hint=_hint, has_recovery=_has_recovery, email_unconfirmed_pattern=_email_unconfirmed_pattern)
class PasswordInputSettings(TLObject):
CONSTRUCTOR_ID = 0x86916deb
SUBCLASS_OF_ID = 0xc426ca6
def __init__(self, new_salt=None, new_password_hash=None, hint=None, email=None):
"""
:param bytes | None new_salt:
:param bytes | None new_password_hash:
:param str | None hint:
:param str | None email:
Constructor for account.PasswordInputSettings: Instance of PasswordInputSettings.
"""
super().__init__()
self.new_salt = new_salt
self.new_password_hash = new_password_hash
self.hint = hint
self.email = email
def to_dict(self):
return {
'_': 'PasswordInputSettings',
'new_salt': self.new_salt,
'new_password_hash': self.new_password_hash,
'hint': self.hint,
'email': self.email
}
def __bytes__(self):
assert ((self.new_salt or self.new_salt is not None) and (self.new_password_hash or self.new_password_hash is not None) and (self.hint or self.hint is not None)) or ((self.new_salt is None or self.new_salt is False) and (self.new_password_hash is None or self.new_password_hash is False) and (self.hint is None or self.hint is False)), 'new_salt, new_password_hash, hint parameters must all be False-y (like None) or all me True-y'
return b''.join((
b'\xebm\x91\x86',
struct.pack('<I', (0 if self.new_salt is None or self.new_salt is False else 1) | (0 if self.new_password_hash is None or self.new_password_hash is False else 1) | (0 if self.hint is None or self.hint is False else 1) | (0 if self.email is None or self.email is False else 2)),
b'' if self.new_salt is None or self.new_salt is False else (TLObject.serialize_bytes(self.new_salt)),
b'' if self.new_password_hash is None or self.new_password_hash is False else (TLObject.serialize_bytes(self.new_password_hash)),
b'' if self.hint is None or self.hint is False else (TLObject.serialize_bytes(self.hint)),
b'' if self.email is None or self.email is False else (TLObject.serialize_bytes(self.email)),
))
@staticmethod
def from_reader(reader):
flags = reader.read_int()
if flags & 1:
_new_salt = reader.tgread_bytes()
else:
_new_salt = None
if flags & 1:
_new_password_hash = reader.tgread_bytes()
else:
_new_password_hash = None
if flags & 1:
_hint = reader.tgread_string()
else:
_hint = None
if flags & 2:
_email = reader.tgread_string()
else:
_email = None
return PasswordInputSettings(new_salt=_new_salt, new_password_hash=_new_password_hash, hint=_hint, email=_email)
class PasswordSettings(TLObject):
CONSTRUCTOR_ID = 0xb7b72ab3
SUBCLASS_OF_ID = 0xd23fb078
def __init__(self, email):
"""
:param str email:
Constructor for account.PasswordSettings: Instance of PasswordSettings.
"""
super().__init__()
self.email = email
def to_dict(self):
return {
'_': 'PasswordSettings',
'email': self.email
}
def __bytes__(self):
return b''.join((
b'\xb3*\xb7\xb7',
TLObject.serialize_bytes(self.email),
))
@staticmethod
def from_reader(reader):
_email = reader.tgread_string()
return PasswordSettings(email=_email)
class PrivacyRules(TLObject):
CONSTRUCTOR_ID = 0x554abb6f
SUBCLASS_OF_ID = 0xb55aba82
def __init__(self, rules, users):
"""
:param list[PrivacyRule] rules:
:param list[User] users:
Constructor for account.PrivacyRules: Instance of PrivacyRules.
"""
super().__init__()
self.rules = rules
self.users = users
def to_dict(self):
return {
'_': 'PrivacyRules',
'rules': [] if self.rules is None else [None if x is None else x.to_dict() for x in self.rules],
'users': [] if self.users is None else [None if x is None else x.to_dict() for x in self.users]
}
def __bytes__(self):
return b''.join((
b'o\xbbJU',
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.rules)),b''.join(bytes(x) for x in self.rules),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.users)),b''.join(bytes(x) for x in self.users),
))
@staticmethod
def from_reader(reader):
reader.read_int()
_rules = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_rules.append(_x)
reader.read_int()
_users = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_users.append(_x)
return PrivacyRules(rules=_rules, users=_users)
class TmpPassword(TLObject):
CONSTRUCTOR_ID = 0xdb64fd34
SUBCLASS_OF_ID = 0xb064992d
def __init__(self, tmp_password, valid_until):
"""
:param bytes tmp_password:
:param int valid_until:
Constructor for account.TmpPassword: Instance of TmpPassword.
"""
super().__init__()
self.tmp_password = tmp_password
self.valid_until = valid_until
def to_dict(self):
return {
'_': 'TmpPassword',
'tmp_password': self.tmp_password,
'valid_until': self.valid_until
}
def __bytes__(self):
return b''.join((
b'4\xfdd\xdb',
TLObject.serialize_bytes(self.tmp_password),
struct.pack('<i', self.valid_until),
))
@staticmethod
def from_reader(reader):
_tmp_password = reader.tgread_bytes()
_valid_until = reader.read_int()
return TmpPassword(tmp_password=_tmp_password, valid_until=_valid_until)

402
telethon/tl/types/auth.py Normal file
View File

@ -0,0 +1,402 @@
"""File generated by TLObjects' generator. All changes will be ERASED"""
from ...tl.tlobject import TLObject
import os
import struct
class Authorization(TLObject):
CONSTRUCTOR_ID = 0xcd050916
SUBCLASS_OF_ID = 0xb9e04e39
def __init__(self, user, tmp_sessions=None):
"""
:param int | None tmp_sessions:
:param User user:
Constructor for auth.Authorization: Instance of Authorization.
"""
super().__init__()
self.tmp_sessions = tmp_sessions
self.user = user
def to_dict(self):
return {
'_': 'Authorization',
'tmp_sessions': self.tmp_sessions,
'user': None if self.user is None else self.user.to_dict()
}
def __bytes__(self):
return b''.join((
b'\x16\t\x05\xcd',
struct.pack('<I', (0 if self.tmp_sessions is None or self.tmp_sessions is False else 1)),
b'' if self.tmp_sessions is None or self.tmp_sessions is False else (struct.pack('<i', self.tmp_sessions)),
bytes(self.user),
))
@staticmethod
def from_reader(reader):
flags = reader.read_int()
if flags & 1:
_tmp_sessions = reader.read_int()
else:
_tmp_sessions = None
_user = reader.tgread_object()
return Authorization(user=_user, tmp_sessions=_tmp_sessions)
class CheckedPhone(TLObject):
CONSTRUCTOR_ID = 0x811ea28e
SUBCLASS_OF_ID = 0x99a3d765
def __init__(self, phone_registered):
"""
:param Bool phone_registered:
Constructor for auth.CheckedPhone: Instance of CheckedPhone.
"""
super().__init__()
self.phone_registered = phone_registered
def to_dict(self):
return {
'_': 'CheckedPhone',
'phone_registered': self.phone_registered
}
def __bytes__(self):
return b''.join((
b'\x8e\xa2\x1e\x81',
b'\xb5ur\x99' if self.phone_registered else b'7\x97y\xbc',
))
@staticmethod
def from_reader(reader):
_phone_registered = reader.tgread_bool()
return CheckedPhone(phone_registered=_phone_registered)
class CodeTypeCall(TLObject):
CONSTRUCTOR_ID = 0x741cd3e3
SUBCLASS_OF_ID = 0xb3f3e401
def __init__(self):
super().__init__()
def to_dict(self):
return {
'_': 'CodeTypeCall'
}
def __bytes__(self):
return b''.join((
b'\xe3\xd3\x1ct',
))
@staticmethod
def from_reader(reader):
return CodeTypeCall()
class CodeTypeFlashCall(TLObject):
CONSTRUCTOR_ID = 0x226ccefb
SUBCLASS_OF_ID = 0xb3f3e401
def __init__(self):
super().__init__()
def to_dict(self):
return {
'_': 'CodeTypeFlashCall'
}
def __bytes__(self):
return b''.join((
b'\xfb\xcel"',
))
@staticmethod
def from_reader(reader):
return CodeTypeFlashCall()
class CodeTypeSms(TLObject):
CONSTRUCTOR_ID = 0x72a3158c
SUBCLASS_OF_ID = 0xb3f3e401
def __init__(self):
super().__init__()
def to_dict(self):
return {
'_': 'CodeTypeSms'
}
def __bytes__(self):
return b''.join((
b'\x8c\x15\xa3r',
))
@staticmethod
def from_reader(reader):
return CodeTypeSms()
class ExportedAuthorization(TLObject):
CONSTRUCTOR_ID = 0xdf969c2d
SUBCLASS_OF_ID = 0x5fd1ec51
def __init__(self, id, bytes):
"""
:param int id:
:param bytes bytes:
Constructor for auth.ExportedAuthorization: Instance of ExportedAuthorization.
"""
super().__init__()
self.id = id
self.bytes = bytes
def to_dict(self):
return {
'_': 'ExportedAuthorization',
'id': self.id,
'bytes': self.bytes
}
def __bytes__(self):
return b''.join((
b'-\x9c\x96\xdf',
struct.pack('<i', self.id),
TLObject.serialize_bytes(self.bytes),
))
@staticmethod
def from_reader(reader):
_id = reader.read_int()
_bytes = reader.tgread_bytes()
return ExportedAuthorization(id=_id, bytes=_bytes)
class PasswordRecovery(TLObject):
CONSTRUCTOR_ID = 0x137948a5
SUBCLASS_OF_ID = 0xfa72d43a
def __init__(self, email_pattern):
"""
:param str email_pattern:
Constructor for auth.PasswordRecovery: Instance of PasswordRecovery.
"""
super().__init__()
self.email_pattern = email_pattern
def to_dict(self):
return {
'_': 'PasswordRecovery',
'email_pattern': self.email_pattern
}
def __bytes__(self):
return b''.join((
b'\xa5Hy\x13',
TLObject.serialize_bytes(self.email_pattern),
))
@staticmethod
def from_reader(reader):
_email_pattern = reader.tgread_string()
return PasswordRecovery(email_pattern=_email_pattern)
class SentCode(TLObject):
CONSTRUCTOR_ID = 0x5e002502
SUBCLASS_OF_ID = 0x6ce87081
def __init__(self, type, phone_code_hash, phone_registered=None, next_type=None, timeout=None):
"""
:param bool | None phone_registered:
:param auth.SentCodeType type:
:param str phone_code_hash:
:param auth.CodeType | None next_type:
:param int | None timeout:
Constructor for auth.SentCode: Instance of SentCode.
"""
super().__init__()
self.phone_registered = phone_registered
self.type = type
self.phone_code_hash = phone_code_hash
self.next_type = next_type
self.timeout = timeout
def to_dict(self):
return {
'_': 'SentCode',
'phone_registered': self.phone_registered,
'type': None if self.type is None else self.type.to_dict(),
'phone_code_hash': self.phone_code_hash,
'next_type': None if self.next_type is None else self.next_type.to_dict(),
'timeout': self.timeout
}
def __bytes__(self):
return b''.join((
b'\x02%\x00^',
struct.pack('<I', (0 if self.phone_registered is None or self.phone_registered is False else 1) | (0 if self.next_type is None or self.next_type is False else 2) | (0 if self.timeout is None or self.timeout is False else 4)),
bytes(self.type),
TLObject.serialize_bytes(self.phone_code_hash),
b'' if self.next_type is None or self.next_type is False else (bytes(self.next_type)),
b'' if self.timeout is None or self.timeout is False else (struct.pack('<i', self.timeout)),
))
@staticmethod
def from_reader(reader):
flags = reader.read_int()
_phone_registered = bool(flags & 1)
_type = reader.tgread_object()
_phone_code_hash = reader.tgread_string()
if flags & 2:
_next_type = reader.tgread_object()
else:
_next_type = None
if flags & 4:
_timeout = reader.read_int()
else:
_timeout = None
return SentCode(type=_type, phone_code_hash=_phone_code_hash, phone_registered=_phone_registered, next_type=_next_type, timeout=_timeout)
class SentCodeTypeApp(TLObject):
CONSTRUCTOR_ID = 0x3dbb5986
SUBCLASS_OF_ID = 0xff5b158e
def __init__(self, length):
"""
:param int length:
Constructor for auth.SentCodeType: Instance of either SentCodeTypeApp, SentCodeTypeSms, SentCodeTypeCall, SentCodeTypeFlashCall.
"""
super().__init__()
self.length = length
def to_dict(self):
return {
'_': 'SentCodeTypeApp',
'length': self.length
}
def __bytes__(self):
return b''.join((
b'\x86Y\xbb=',
struct.pack('<i', self.length),
))
@staticmethod
def from_reader(reader):
_length = reader.read_int()
return SentCodeTypeApp(length=_length)
class SentCodeTypeCall(TLObject):
CONSTRUCTOR_ID = 0x5353e5a7
SUBCLASS_OF_ID = 0xff5b158e
def __init__(self, length):
"""
:param int length:
Constructor for auth.SentCodeType: Instance of either SentCodeTypeApp, SentCodeTypeSms, SentCodeTypeCall, SentCodeTypeFlashCall.
"""
super().__init__()
self.length = length
def to_dict(self):
return {
'_': 'SentCodeTypeCall',
'length': self.length
}
def __bytes__(self):
return b''.join((
b'\xa7\xe5SS',
struct.pack('<i', self.length),
))
@staticmethod
def from_reader(reader):
_length = reader.read_int()
return SentCodeTypeCall(length=_length)
class SentCodeTypeFlashCall(TLObject):
CONSTRUCTOR_ID = 0xab03c6d9
SUBCLASS_OF_ID = 0xff5b158e
def __init__(self, pattern):
"""
:param str pattern:
Constructor for auth.SentCodeType: Instance of either SentCodeTypeApp, SentCodeTypeSms, SentCodeTypeCall, SentCodeTypeFlashCall.
"""
super().__init__()
self.pattern = pattern
def to_dict(self):
return {
'_': 'SentCodeTypeFlashCall',
'pattern': self.pattern
}
def __bytes__(self):
return b''.join((
b'\xd9\xc6\x03\xab',
TLObject.serialize_bytes(self.pattern),
))
@staticmethod
def from_reader(reader):
_pattern = reader.tgread_string()
return SentCodeTypeFlashCall(pattern=_pattern)
class SentCodeTypeSms(TLObject):
CONSTRUCTOR_ID = 0xc000bba2
SUBCLASS_OF_ID = 0xff5b158e
def __init__(self, length):
"""
:param int length:
Constructor for auth.SentCodeType: Instance of either SentCodeTypeApp, SentCodeTypeSms, SentCodeTypeCall, SentCodeTypeFlashCall.
"""
super().__init__()
self.length = length
def to_dict(self):
return {
'_': 'SentCodeTypeSms',
'length': self.length
}
def __bytes__(self):
return b''.join((
b'\xa2\xbb\x00\xc0',
struct.pack('<i', self.length),
))
@staticmethod
def from_reader(reader):
_length = reader.read_int()
return SentCodeTypeSms(length=_length)

View File

@ -0,0 +1,177 @@
"""File generated by TLObjects' generator. All changes will be ERASED"""
from ...tl.tlobject import TLObject
import os
import struct
class AdminLogResults(TLObject):
CONSTRUCTOR_ID = 0xed8af74d
SUBCLASS_OF_ID = 0x51f076bc
def __init__(self, events, chats, users):
"""
:param list[ChannelAdminLogEvent] events:
:param list[Chat] chats:
:param list[User] users:
Constructor for channels.AdminLogResults: Instance of AdminLogResults.
"""
super().__init__()
self.events = events
self.chats = chats
self.users = users
def to_dict(self):
return {
'_': 'AdminLogResults',
'events': [] if self.events is None else [None if x is None else x.to_dict() for x in self.events],
'chats': [] if self.chats is None else [None if x is None else x.to_dict() for x in self.chats],
'users': [] if self.users is None else [None if x is None else x.to_dict() for x in self.users]
}
def __bytes__(self):
return b''.join((
b'M\xf7\x8a\xed',
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.events)),b''.join(bytes(x) for x in self.events),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.chats)),b''.join(bytes(x) for x in self.chats),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.users)),b''.join(bytes(x) for x in self.users),
))
@staticmethod
def from_reader(reader):
reader.read_int()
_events = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_events.append(_x)
reader.read_int()
_chats = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_chats.append(_x)
reader.read_int()
_users = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_users.append(_x)
return AdminLogResults(events=_events, chats=_chats, users=_users)
class ChannelParticipant(TLObject):
CONSTRUCTOR_ID = 0xd0d9b163
SUBCLASS_OF_ID = 0x6658151a
def __init__(self, participant, users):
"""
:param ChannelParticipant participant:
:param list[User] users:
Constructor for channels.ChannelParticipant: Instance of ChannelParticipant.
"""
super().__init__()
self.participant = participant
self.users = users
def to_dict(self):
return {
'_': 'ChannelParticipant',
'participant': None if self.participant is None else self.participant.to_dict(),
'users': [] if self.users is None else [None if x is None else x.to_dict() for x in self.users]
}
def __bytes__(self):
return b''.join((
b'c\xb1\xd9\xd0',
bytes(self.participant),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.users)),b''.join(bytes(x) for x in self.users),
))
@staticmethod
def from_reader(reader):
_participant = reader.tgread_object()
reader.read_int()
_users = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_users.append(_x)
return ChannelParticipant(participant=_participant, users=_users)
class ChannelParticipants(TLObject):
CONSTRUCTOR_ID = 0xf56ee2a8
SUBCLASS_OF_ID = 0xe60a6e64
def __init__(self, count, participants, users):
"""
:param int count:
:param list[ChannelParticipant] participants:
:param list[User] users:
Constructor for channels.ChannelParticipants: Instance of either ChannelParticipants, ChannelParticipantsNotModified.
"""
super().__init__()
self.count = count
self.participants = participants
self.users = users
def to_dict(self):
return {
'_': 'ChannelParticipants',
'count': self.count,
'participants': [] if self.participants is None else [None if x is None else x.to_dict() for x in self.participants],
'users': [] if self.users is None else [None if x is None else x.to_dict() for x in self.users]
}
def __bytes__(self):
return b''.join((
b'\xa8\xe2n\xf5',
struct.pack('<i', self.count),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.participants)),b''.join(bytes(x) for x in self.participants),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.users)),b''.join(bytes(x) for x in self.users),
))
@staticmethod
def from_reader(reader):
_count = reader.read_int()
reader.read_int()
_participants = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_participants.append(_x)
reader.read_int()
_users = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_users.append(_x)
return ChannelParticipants(count=_count, participants=_participants, users=_users)
class ChannelParticipantsNotModified(TLObject):
CONSTRUCTOR_ID = 0xf0173fe9
SUBCLASS_OF_ID = 0xe60a6e64
def __init__(self):
super().__init__()
def to_dict(self):
return {
'_': 'ChannelParticipantsNotModified'
}
def __bytes__(self):
return b''.join((
b'\xe9?\x17\xf0',
))
@staticmethod
def from_reader(reader):
return ChannelParticipantsNotModified()

View File

@ -0,0 +1,484 @@
"""File generated by TLObjects' generator. All changes will be ERASED"""
from ...tl.tlobject import TLObject
import os
import struct
class Blocked(TLObject):
CONSTRUCTOR_ID = 0x1c138d15
SUBCLASS_OF_ID = 0xffba4f4f
def __init__(self, blocked, users):
"""
:param list[ContactBlocked] blocked:
:param list[User] users:
Constructor for contacts.Blocked: Instance of either Blocked, BlockedSlice.
"""
super().__init__()
self.blocked = blocked
self.users = users
def to_dict(self):
return {
'_': 'Blocked',
'blocked': [] if self.blocked is None else [None if x is None else x.to_dict() for x in self.blocked],
'users': [] if self.users is None else [None if x is None else x.to_dict() for x in self.users]
}
def __bytes__(self):
return b''.join((
b'\x15\x8d\x13\x1c',
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.blocked)),b''.join(bytes(x) for x in self.blocked),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.users)),b''.join(bytes(x) for x in self.users),
))
@staticmethod
def from_reader(reader):
reader.read_int()
_blocked = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_blocked.append(_x)
reader.read_int()
_users = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_users.append(_x)
return Blocked(blocked=_blocked, users=_users)
class BlockedSlice(TLObject):
CONSTRUCTOR_ID = 0x900802a1
SUBCLASS_OF_ID = 0xffba4f4f
def __init__(self, count, blocked, users):
"""
:param int count:
:param list[ContactBlocked] blocked:
:param list[User] users:
Constructor for contacts.Blocked: Instance of either Blocked, BlockedSlice.
"""
super().__init__()
self.count = count
self.blocked = blocked
self.users = users
def to_dict(self):
return {
'_': 'BlockedSlice',
'count': self.count,
'blocked': [] if self.blocked is None else [None if x is None else x.to_dict() for x in self.blocked],
'users': [] if self.users is None else [None if x is None else x.to_dict() for x in self.users]
}
def __bytes__(self):
return b''.join((
b'\xa1\x02\x08\x90',
struct.pack('<i', self.count),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.blocked)),b''.join(bytes(x) for x in self.blocked),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.users)),b''.join(bytes(x) for x in self.users),
))
@staticmethod
def from_reader(reader):
_count = reader.read_int()
reader.read_int()
_blocked = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_blocked.append(_x)
reader.read_int()
_users = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_users.append(_x)
return BlockedSlice(count=_count, blocked=_blocked, users=_users)
class Contacts(TLObject):
CONSTRUCTOR_ID = 0xeae87e42
SUBCLASS_OF_ID = 0x38be25f6
def __init__(self, contacts, saved_count, users):
"""
:param list[Contact] contacts:
:param int saved_count:
:param list[User] users:
Constructor for contacts.Contacts: Instance of either ContactsNotModified, Contacts.
"""
super().__init__()
self.contacts = contacts
self.saved_count = saved_count
self.users = users
def to_dict(self):
return {
'_': 'Contacts',
'contacts': [] if self.contacts is None else [None if x is None else x.to_dict() for x in self.contacts],
'saved_count': self.saved_count,
'users': [] if self.users is None else [None if x is None else x.to_dict() for x in self.users]
}
def __bytes__(self):
return b''.join((
b'B~\xe8\xea',
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.contacts)),b''.join(bytes(x) for x in self.contacts),
struct.pack('<i', self.saved_count),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.users)),b''.join(bytes(x) for x in self.users),
))
@staticmethod
def from_reader(reader):
reader.read_int()
_contacts = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_contacts.append(_x)
_saved_count = reader.read_int()
reader.read_int()
_users = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_users.append(_x)
return Contacts(contacts=_contacts, saved_count=_saved_count, users=_users)
class ContactsNotModified(TLObject):
CONSTRUCTOR_ID = 0xb74ba9d2
SUBCLASS_OF_ID = 0x38be25f6
def __init__(self):
super().__init__()
def to_dict(self):
return {
'_': 'ContactsNotModified'
}
def __bytes__(self):
return b''.join((
b'\xd2\xa9K\xb7',
))
@staticmethod
def from_reader(reader):
return ContactsNotModified()
class Found(TLObject):
CONSTRUCTOR_ID = 0xb3134d9d
SUBCLASS_OF_ID = 0x4386a2e3
def __init__(self, my_results, results, chats, users):
"""
:param list[Peer] my_results:
:param list[Peer] results:
:param list[Chat] chats:
:param list[User] users:
Constructor for contacts.Found: Instance of Found.
"""
super().__init__()
self.my_results = my_results
self.results = results
self.chats = chats
self.users = users
def to_dict(self):
return {
'_': 'Found',
'my_results': [] if self.my_results is None else [None if x is None else x.to_dict() for x in self.my_results],
'results': [] if self.results is None else [None if x is None else x.to_dict() for x in self.results],
'chats': [] if self.chats is None else [None if x is None else x.to_dict() for x in self.chats],
'users': [] if self.users is None else [None if x is None else x.to_dict() for x in self.users]
}
def __bytes__(self):
return b''.join((
b'\x9dM\x13\xb3',
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.my_results)),b''.join(bytes(x) for x in self.my_results),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.results)),b''.join(bytes(x) for x in self.results),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.chats)),b''.join(bytes(x) for x in self.chats),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.users)),b''.join(bytes(x) for x in self.users),
))
@staticmethod
def from_reader(reader):
reader.read_int()
_my_results = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_my_results.append(_x)
reader.read_int()
_results = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_results.append(_x)
reader.read_int()
_chats = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_chats.append(_x)
reader.read_int()
_users = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_users.append(_x)
return Found(my_results=_my_results, results=_results, chats=_chats, users=_users)
class ImportedContacts(TLObject):
CONSTRUCTOR_ID = 0x77d01c3b
SUBCLASS_OF_ID = 0x8172ad93
def __init__(self, imported, popular_invites, retry_contacts, users):
"""
:param list[ImportedContact] imported:
:param list[PopularContact] popular_invites:
:param list[int] retry_contacts:
:param list[User] users:
Constructor for contacts.ImportedContacts: Instance of ImportedContacts.
"""
super().__init__()
self.imported = imported
self.popular_invites = popular_invites
self.retry_contacts = retry_contacts
self.users = users
def to_dict(self):
return {
'_': 'ImportedContacts',
'imported': [] if self.imported is None else [None if x is None else x.to_dict() for x in self.imported],
'popular_invites': [] if self.popular_invites is None else [None if x is None else x.to_dict() for x in self.popular_invites],
'retry_contacts': [] if self.retry_contacts is None else self.retry_contacts[:],
'users': [] if self.users is None else [None if x is None else x.to_dict() for x in self.users]
}
def __bytes__(self):
return b''.join((
b';\x1c\xd0w',
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.imported)),b''.join(bytes(x) for x in self.imported),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.popular_invites)),b''.join(bytes(x) for x in self.popular_invites),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.retry_contacts)),b''.join(struct.pack('<q', x) for x in self.retry_contacts),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.users)),b''.join(bytes(x) for x in self.users),
))
@staticmethod
def from_reader(reader):
reader.read_int()
_imported = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_imported.append(_x)
reader.read_int()
_popular_invites = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_popular_invites.append(_x)
reader.read_int()
_retry_contacts = []
for _ in range(reader.read_int()):
_x = reader.read_long()
_retry_contacts.append(_x)
reader.read_int()
_users = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_users.append(_x)
return ImportedContacts(imported=_imported, popular_invites=_popular_invites, retry_contacts=_retry_contacts, users=_users)
class Link(TLObject):
CONSTRUCTOR_ID = 0x3ace484c
SUBCLASS_OF_ID = 0x524d5ae9
def __init__(self, my_link, foreign_link, user):
"""
:param ContactLink my_link:
:param ContactLink foreign_link:
:param User user:
Constructor for contacts.Link: Instance of Link.
"""
super().__init__()
self.my_link = my_link
self.foreign_link = foreign_link
self.user = user
def to_dict(self):
return {
'_': 'Link',
'my_link': None if self.my_link is None else self.my_link.to_dict(),
'foreign_link': None if self.foreign_link is None else self.foreign_link.to_dict(),
'user': None if self.user is None else self.user.to_dict()
}
def __bytes__(self):
return b''.join((
b'LH\xce:',
bytes(self.my_link),
bytes(self.foreign_link),
bytes(self.user),
))
@staticmethod
def from_reader(reader):
_my_link = reader.tgread_object()
_foreign_link = reader.tgread_object()
_user = reader.tgread_object()
return Link(my_link=_my_link, foreign_link=_foreign_link, user=_user)
class ResolvedPeer(TLObject):
CONSTRUCTOR_ID = 0x7f077ad9
SUBCLASS_OF_ID = 0xf065b3a8
def __init__(self, peer, chats, users):
"""
:param Peer peer:
:param list[Chat] chats:
:param list[User] users:
Constructor for contacts.ResolvedPeer: Instance of ResolvedPeer.
"""
super().__init__()
self.peer = peer
self.chats = chats
self.users = users
def to_dict(self):
return {
'_': 'ResolvedPeer',
'peer': None if self.peer is None else self.peer.to_dict(),
'chats': [] if self.chats is None else [None if x is None else x.to_dict() for x in self.chats],
'users': [] if self.users is None else [None if x is None else x.to_dict() for x in self.users]
}
def __bytes__(self):
return b''.join((
b'\xd9z\x07\x7f',
bytes(self.peer),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.chats)),b''.join(bytes(x) for x in self.chats),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.users)),b''.join(bytes(x) for x in self.users),
))
@staticmethod
def from_reader(reader):
_peer = reader.tgread_object()
reader.read_int()
_chats = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_chats.append(_x)
reader.read_int()
_users = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_users.append(_x)
return ResolvedPeer(peer=_peer, chats=_chats, users=_users)
class TopPeers(TLObject):
CONSTRUCTOR_ID = 0x70b772a8
SUBCLASS_OF_ID = 0x9ee8bb88
def __init__(self, categories, chats, users):
"""
:param list[TopPeerCategoryPeers] categories:
:param list[Chat] chats:
:param list[User] users:
Constructor for contacts.TopPeers: Instance of either TopPeersNotModified, TopPeers.
"""
super().__init__()
self.categories = categories
self.chats = chats
self.users = users
def to_dict(self):
return {
'_': 'TopPeers',
'categories': [] if self.categories is None else [None if x is None else x.to_dict() for x in self.categories],
'chats': [] if self.chats is None else [None if x is None else x.to_dict() for x in self.chats],
'users': [] if self.users is None else [None if x is None else x.to_dict() for x in self.users]
}
def __bytes__(self):
return b''.join((
b'\xa8r\xb7p',
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.categories)),b''.join(bytes(x) for x in self.categories),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.chats)),b''.join(bytes(x) for x in self.chats),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.users)),b''.join(bytes(x) for x in self.users),
))
@staticmethod
def from_reader(reader):
reader.read_int()
_categories = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_categories.append(_x)
reader.read_int()
_chats = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_chats.append(_x)
reader.read_int()
_users = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_users.append(_x)
return TopPeers(categories=_categories, chats=_chats, users=_users)
class TopPeersNotModified(TLObject):
CONSTRUCTOR_ID = 0xde266ef5
SUBCLASS_OF_ID = 0x9ee8bb88
def __init__(self):
super().__init__()
def to_dict(self):
return {
'_': 'TopPeersNotModified'
}
def __bytes__(self):
return b''.join((
b'\xf5n&\xde',
))
@staticmethod
def from_reader(reader):
return TopPeersNotModified()

284
telethon/tl/types/help.py Normal file
View File

@ -0,0 +1,284 @@
"""File generated by TLObjects' generator. All changes will be ERASED"""
from ...tl.tlobject import TLObject
import os
import struct
class AppUpdate(TLObject):
CONSTRUCTOR_ID = 0x8987f311
SUBCLASS_OF_ID = 0x5897069e
def __init__(self, id, critical, url, text):
"""
:param int id:
:param Bool critical:
:param str url:
:param str text:
Constructor for help.AppUpdate: Instance of either AppUpdate, NoAppUpdate.
"""
super().__init__()
self.id = id
self.critical = critical
self.url = url
self.text = text
def to_dict(self):
return {
'_': 'AppUpdate',
'id': self.id,
'critical': self.critical,
'url': self.url,
'text': self.text
}
def __bytes__(self):
return b''.join((
b'\x11\xf3\x87\x89',
struct.pack('<i', self.id),
b'\xb5ur\x99' if self.critical else b'7\x97y\xbc',
TLObject.serialize_bytes(self.url),
TLObject.serialize_bytes(self.text),
))
@staticmethod
def from_reader(reader):
_id = reader.read_int()
_critical = reader.tgread_bool()
_url = reader.tgread_string()
_text = reader.tgread_string()
return AppUpdate(id=_id, critical=_critical, url=_url, text=_text)
class ConfigSimple(TLObject):
CONSTRUCTOR_ID = 0xd997c3c5
SUBCLASS_OF_ID = 0x29183ac4
def __init__(self, date, expires, dc_id, ip_port_list):
"""
:param datetime.datetime | None date:
:param datetime.datetime | None expires:
:param int dc_id:
:param list[ipPort] ip_port_list:
Constructor for help.ConfigSimple: Instance of ConfigSimple.
"""
super().__init__()
self.date = date
self.expires = expires
self.dc_id = dc_id
self.ip_port_list = ip_port_list
def to_dict(self):
return {
'_': 'ConfigSimple',
'date': self.date,
'expires': self.expires,
'dc_id': self.dc_id,
'ip_port_list': [] if self.ip_port_list is None else [None if x is None else x.to_dict() for x in self.ip_port_list]
}
def __bytes__(self):
return b''.join((
b'\xc5\xc3\x97\xd9',
TLObject.serialize_datetime(self.date),
TLObject.serialize_datetime(self.expires),
struct.pack('<i', self.dc_id),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.ip_port_list)),b''.join(bytes(x) for x in self.ip_port_list),
))
@staticmethod
def from_reader(reader):
_date = reader.tgread_date()
_expires = reader.tgread_date()
_dc_id = reader.read_int()
reader.read_int()
_ip_port_list = []
for _ in range(reader.read_int()):
from . import IpPort
_x = IpPort.from_reader(reader)
_ip_port_list.append(_x)
return ConfigSimple(date=_date, expires=_expires, dc_id=_dc_id, ip_port_list=_ip_port_list)
class InviteText(TLObject):
CONSTRUCTOR_ID = 0x18cb9f78
SUBCLASS_OF_ID = 0xcf70aa35
def __init__(self, message):
"""
:param str message:
Constructor for help.InviteText: Instance of InviteText.
"""
super().__init__()
self.message = message
def to_dict(self):
return {
'_': 'InviteText',
'message': self.message
}
def __bytes__(self):
return b''.join((
b'x\x9f\xcb\x18',
TLObject.serialize_bytes(self.message),
))
@staticmethod
def from_reader(reader):
_message = reader.tgread_string()
return InviteText(message=_message)
class NoAppUpdate(TLObject):
CONSTRUCTOR_ID = 0xc45a6536
SUBCLASS_OF_ID = 0x5897069e
def __init__(self):
super().__init__()
def to_dict(self):
return {
'_': 'NoAppUpdate'
}
def __bytes__(self):
return b''.join((
b'6eZ\xc4',
))
@staticmethod
def from_reader(reader):
return NoAppUpdate()
class RecentMeUrls(TLObject):
CONSTRUCTOR_ID = 0xe0310d7
SUBCLASS_OF_ID = 0xf269c477
def __init__(self, urls, chats, users):
"""
:param list[RecentMeUrl] urls:
:param list[Chat] chats:
:param list[User] users:
Constructor for help.RecentMeUrls: Instance of RecentMeUrls.
"""
super().__init__()
self.urls = urls
self.chats = chats
self.users = users
def to_dict(self):
return {
'_': 'RecentMeUrls',
'urls': [] if self.urls is None else [None if x is None else x.to_dict() for x in self.urls],
'chats': [] if self.chats is None else [None if x is None else x.to_dict() for x in self.chats],
'users': [] if self.users is None else [None if x is None else x.to_dict() for x in self.users]
}
def __bytes__(self):
return b''.join((
b'\xd7\x10\x03\x0e',
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.urls)),b''.join(bytes(x) for x in self.urls),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.chats)),b''.join(bytes(x) for x in self.chats),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.users)),b''.join(bytes(x) for x in self.users),
))
@staticmethod
def from_reader(reader):
reader.read_int()
_urls = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_urls.append(_x)
reader.read_int()
_chats = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_chats.append(_x)
reader.read_int()
_users = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_users.append(_x)
return RecentMeUrls(urls=_urls, chats=_chats, users=_users)
class Support(TLObject):
CONSTRUCTOR_ID = 0x17c6b5f6
SUBCLASS_OF_ID = 0x7159bceb
def __init__(self, phone_number, user):
"""
:param str phone_number:
:param User user:
Constructor for help.Support: Instance of Support.
"""
super().__init__()
self.phone_number = phone_number
self.user = user
def to_dict(self):
return {
'_': 'Support',
'phone_number': self.phone_number,
'user': None if self.user is None else self.user.to_dict()
}
def __bytes__(self):
return b''.join((
b'\xf6\xb5\xc6\x17',
TLObject.serialize_bytes(self.phone_number),
bytes(self.user),
))
@staticmethod
def from_reader(reader):
_phone_number = reader.tgread_string()
_user = reader.tgread_object()
return Support(phone_number=_phone_number, user=_user)
class TermsOfService(TLObject):
CONSTRUCTOR_ID = 0xf1ee3e90
SUBCLASS_OF_ID = 0x20ee8312
def __init__(self, text):
"""
:param str text:
Constructor for help.TermsOfService: Instance of TermsOfService.
"""
super().__init__()
self.text = text
def to_dict(self):
return {
'_': 'TermsOfService',
'text': self.text
}
def __bytes__(self):
return b''.join((
b'\x90>\xee\xf1',
TLObject.serialize_bytes(self.text),
))
@staticmethod
def from_reader(reader):
_text = reader.tgread_string()
return TermsOfService(text=_text)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,353 @@
"""File generated by TLObjects' generator. All changes will be ERASED"""
from ...tl.tlobject import TLObject
import os
import struct
class PaymentForm(TLObject):
CONSTRUCTOR_ID = 0x3f56aea3
SUBCLASS_OF_ID = 0xa0483f19
def __init__(self, bot_id, invoice, provider_id, url, users, can_save_credentials=None, password_missing=None, native_provider=None, native_params=None, saved_info=None, saved_credentials=None):
"""
:param bool | None can_save_credentials:
:param bool | None password_missing:
:param int bot_id:
:param Invoice invoice:
:param int provider_id:
:param str url:
:param str | None native_provider:
:param DataJSON | None native_params:
:param PaymentRequestedInfo | None saved_info:
:param PaymentSavedCredentials | None saved_credentials:
:param list[User] users:
Constructor for payments.PaymentForm: Instance of PaymentForm.
"""
super().__init__()
self.can_save_credentials = can_save_credentials
self.password_missing = password_missing
self.bot_id = bot_id
self.invoice = invoice
self.provider_id = provider_id
self.url = url
self.native_provider = native_provider
self.native_params = native_params
self.saved_info = saved_info
self.saved_credentials = saved_credentials
self.users = users
def to_dict(self):
return {
'_': 'PaymentForm',
'can_save_credentials': self.can_save_credentials,
'password_missing': self.password_missing,
'bot_id': self.bot_id,
'invoice': None if self.invoice is None else self.invoice.to_dict(),
'provider_id': self.provider_id,
'url': self.url,
'native_provider': self.native_provider,
'native_params': None if self.native_params is None else self.native_params.to_dict(),
'saved_info': None if self.saved_info is None else self.saved_info.to_dict(),
'saved_credentials': None if self.saved_credentials is None else self.saved_credentials.to_dict(),
'users': [] if self.users is None else [None if x is None else x.to_dict() for x in self.users]
}
def __bytes__(self):
assert ((self.native_provider or self.native_provider is not None) and (self.native_params or self.native_params is not None)) or ((self.native_provider is None or self.native_provider is False) and (self.native_params is None or self.native_params is False)), 'native_provider, native_params parameters must all be False-y (like None) or all me True-y'
return b''.join((
b'\xa3\xaeV?',
struct.pack('<I', (0 if self.can_save_credentials is None or self.can_save_credentials is False else 4) | (0 if self.password_missing is None or self.password_missing is False else 8) | (0 if self.native_provider is None or self.native_provider is False else 16) | (0 if self.native_params is None or self.native_params is False else 16) | (0 if self.saved_info is None or self.saved_info is False else 1) | (0 if self.saved_credentials is None or self.saved_credentials is False else 2)),
struct.pack('<i', self.bot_id),
bytes(self.invoice),
struct.pack('<i', self.provider_id),
TLObject.serialize_bytes(self.url),
b'' if self.native_provider is None or self.native_provider is False else (TLObject.serialize_bytes(self.native_provider)),
b'' if self.native_params is None or self.native_params is False else (bytes(self.native_params)),
b'' if self.saved_info is None or self.saved_info is False else (bytes(self.saved_info)),
b'' if self.saved_credentials is None or self.saved_credentials is False else (bytes(self.saved_credentials)),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.users)),b''.join(bytes(x) for x in self.users),
))
@staticmethod
def from_reader(reader):
flags = reader.read_int()
_can_save_credentials = bool(flags & 4)
_password_missing = bool(flags & 8)
_bot_id = reader.read_int()
_invoice = reader.tgread_object()
_provider_id = reader.read_int()
_url = reader.tgread_string()
if flags & 16:
_native_provider = reader.tgread_string()
else:
_native_provider = None
if flags & 16:
_native_params = reader.tgread_object()
else:
_native_params = None
if flags & 1:
_saved_info = reader.tgread_object()
else:
_saved_info = None
if flags & 2:
_saved_credentials = reader.tgread_object()
else:
_saved_credentials = None
reader.read_int()
_users = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_users.append(_x)
return PaymentForm(bot_id=_bot_id, invoice=_invoice, provider_id=_provider_id, url=_url, users=_users, can_save_credentials=_can_save_credentials, password_missing=_password_missing, native_provider=_native_provider, native_params=_native_params, saved_info=_saved_info, saved_credentials=_saved_credentials)
class PaymentReceipt(TLObject):
CONSTRUCTOR_ID = 0x500911e1
SUBCLASS_OF_ID = 0x590093c9
def __init__(self, date, bot_id, invoice, provider_id, currency, total_amount, credentials_title, users, info=None, shipping=None):
"""
:param datetime.datetime | None date:
:param int bot_id:
:param Invoice invoice:
:param int provider_id:
:param PaymentRequestedInfo | None info:
:param ShippingOption | None shipping:
:param str currency:
:param int total_amount:
:param str credentials_title:
:param list[User] users:
Constructor for payments.PaymentReceipt: Instance of PaymentReceipt.
"""
super().__init__()
self.date = date
self.bot_id = bot_id
self.invoice = invoice
self.provider_id = provider_id
self.info = info
self.shipping = shipping
self.currency = currency
self.total_amount = total_amount
self.credentials_title = credentials_title
self.users = users
def to_dict(self):
return {
'_': 'PaymentReceipt',
'date': self.date,
'bot_id': self.bot_id,
'invoice': None if self.invoice is None else self.invoice.to_dict(),
'provider_id': self.provider_id,
'info': None if self.info is None else self.info.to_dict(),
'shipping': None if self.shipping is None else self.shipping.to_dict(),
'currency': self.currency,
'total_amount': self.total_amount,
'credentials_title': self.credentials_title,
'users': [] if self.users is None else [None if x is None else x.to_dict() for x in self.users]
}
def __bytes__(self):
return b''.join((
b'\xe1\x11\tP',
struct.pack('<I', (0 if self.info is None or self.info is False else 1) | (0 if self.shipping is None or self.shipping is False else 2)),
TLObject.serialize_datetime(self.date),
struct.pack('<i', self.bot_id),
bytes(self.invoice),
struct.pack('<i', self.provider_id),
b'' if self.info is None or self.info is False else (bytes(self.info)),
b'' if self.shipping is None or self.shipping is False else (bytes(self.shipping)),
TLObject.serialize_bytes(self.currency),
struct.pack('<q', self.total_amount),
TLObject.serialize_bytes(self.credentials_title),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.users)),b''.join(bytes(x) for x in self.users),
))
@staticmethod
def from_reader(reader):
flags = reader.read_int()
_date = reader.tgread_date()
_bot_id = reader.read_int()
_invoice = reader.tgread_object()
_provider_id = reader.read_int()
if flags & 1:
_info = reader.tgread_object()
else:
_info = None
if flags & 2:
_shipping = reader.tgread_object()
else:
_shipping = None
_currency = reader.tgread_string()
_total_amount = reader.read_long()
_credentials_title = reader.tgread_string()
reader.read_int()
_users = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_users.append(_x)
return PaymentReceipt(date=_date, bot_id=_bot_id, invoice=_invoice, provider_id=_provider_id, currency=_currency, total_amount=_total_amount, credentials_title=_credentials_title, users=_users, info=_info, shipping=_shipping)
class PaymentResult(TLObject):
CONSTRUCTOR_ID = 0x4e5f810d
SUBCLASS_OF_ID = 0x8ae16a9d
def __init__(self, updates):
"""
:param Updates updates:
Constructor for payments.PaymentResult: Instance of either PaymentResult, PaymentVerficationNeeded.
"""
super().__init__()
self.updates = updates
def to_dict(self):
return {
'_': 'PaymentResult',
'updates': None if self.updates is None else self.updates.to_dict()
}
def __bytes__(self):
return b''.join((
b'\r\x81_N',
bytes(self.updates),
))
@staticmethod
def from_reader(reader):
_updates = reader.tgread_object()
return PaymentResult(updates=_updates)
class PaymentVerficationNeeded(TLObject):
CONSTRUCTOR_ID = 0x6b56b921
SUBCLASS_OF_ID = 0x8ae16a9d
def __init__(self, url):
"""
:param str url:
Constructor for payments.PaymentResult: Instance of either PaymentResult, PaymentVerficationNeeded.
"""
super().__init__()
self.url = url
def to_dict(self):
return {
'_': 'PaymentVerficationNeeded',
'url': self.url
}
def __bytes__(self):
return b''.join((
b'!\xb9Vk',
TLObject.serialize_bytes(self.url),
))
@staticmethod
def from_reader(reader):
_url = reader.tgread_string()
return PaymentVerficationNeeded(url=_url)
class SavedInfo(TLObject):
CONSTRUCTOR_ID = 0xfb8fe43c
SUBCLASS_OF_ID = 0xad3cf146
def __init__(self, has_saved_credentials=None, saved_info=None):
"""
:param bool | None has_saved_credentials:
:param PaymentRequestedInfo | None saved_info:
Constructor for payments.SavedInfo: Instance of SavedInfo.
"""
super().__init__()
self.has_saved_credentials = has_saved_credentials
self.saved_info = saved_info
def to_dict(self):
return {
'_': 'SavedInfo',
'has_saved_credentials': self.has_saved_credentials,
'saved_info': None if self.saved_info is None else self.saved_info.to_dict()
}
def __bytes__(self):
return b''.join((
b'<\xe4\x8f\xfb',
struct.pack('<I', (0 if self.has_saved_credentials is None or self.has_saved_credentials is False else 2) | (0 if self.saved_info is None or self.saved_info is False else 1)),
b'' if self.saved_info is None or self.saved_info is False else (bytes(self.saved_info)),
))
@staticmethod
def from_reader(reader):
flags = reader.read_int()
_has_saved_credentials = bool(flags & 2)
if flags & 1:
_saved_info = reader.tgread_object()
else:
_saved_info = None
return SavedInfo(has_saved_credentials=_has_saved_credentials, saved_info=_saved_info)
class ValidatedRequestedInfo(TLObject):
CONSTRUCTOR_ID = 0xd1451883
SUBCLASS_OF_ID = 0x8f8044b7
def __init__(self, id=None, shipping_options=None):
"""
:param str | None id:
:param list[ShippingOption] | None shipping_options:
Constructor for payments.ValidatedRequestedInfo: Instance of ValidatedRequestedInfo.
"""
super().__init__()
self.id = id
self.shipping_options = shipping_options
def to_dict(self):
return {
'_': 'ValidatedRequestedInfo',
'id': self.id,
'shipping_options': [] if self.shipping_options is None else [None if x is None else x.to_dict() for x in self.shipping_options]
}
def __bytes__(self):
return b''.join((
b'\x83\x18E\xd1',
struct.pack('<I', (0 if self.id is None or self.id is False else 1) | (0 if self.shipping_options is None or self.shipping_options is False else 2)),
b'' if self.id is None or self.id is False else (TLObject.serialize_bytes(self.id)),
b'' if self.shipping_options is None or self.shipping_options is False else b''.join((b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.shipping_options)),b''.join(bytes(x) for x in self.shipping_options))),
))
@staticmethod
def from_reader(reader):
flags = reader.read_int()
if flags & 1:
_id = reader.tgread_string()
else:
_id = None
if flags & 2:
reader.read_int()
_shipping_options = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_shipping_options.append(_x)
else:
_shipping_options = None
return ValidatedRequestedInfo(id=_id, shipping_options=_shipping_options)

View File

@ -0,0 +1,46 @@
"""File generated by TLObjects' generator. All changes will be ERASED"""
from ...tl.tlobject import TLObject
import os
import struct
class PhoneCall(TLObject):
CONSTRUCTOR_ID = 0xec82e140
SUBCLASS_OF_ID = 0xd48afe4f
def __init__(self, phone_call, users):
"""
:param PhoneCall phone_call:
:param list[User] users:
Constructor for phone.PhoneCall: Instance of PhoneCall.
"""
super().__init__()
self.phone_call = phone_call
self.users = users
def to_dict(self):
return {
'_': 'PhoneCall',
'phone_call': None if self.phone_call is None else self.phone_call.to_dict(),
'users': [] if self.users is None else [None if x is None else x.to_dict() for x in self.users]
}
def __bytes__(self):
return b''.join((
b'@\xe1\x82\xec',
bytes(self.phone_call),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.users)),b''.join(bytes(x) for x in self.users),
))
@staticmethod
def from_reader(reader):
_phone_call = reader.tgread_object()
reader.read_int()
_users = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_users.append(_x)
return PhoneCall(phone_call=_phone_call, users=_users)

145
telethon/tl/types/photos.py Normal file
View File

@ -0,0 +1,145 @@
"""File generated by TLObjects' generator. All changes will be ERASED"""
from ...tl.tlobject import TLObject
import os
import struct
class Photo(TLObject):
CONSTRUCTOR_ID = 0x20212ca8
SUBCLASS_OF_ID = 0xc292bd24
def __init__(self, photo, users):
"""
:param Photo photo:
:param list[User] users:
Constructor for photos.Photo: Instance of Photo.
"""
super().__init__()
self.photo = photo
self.users = users
def to_dict(self):
return {
'_': 'Photo',
'photo': None if self.photo is None else self.photo.to_dict(),
'users': [] if self.users is None else [None if x is None else x.to_dict() for x in self.users]
}
def __bytes__(self):
return b''.join((
b'\xa8,! ',
bytes(self.photo),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.users)),b''.join(bytes(x) for x in self.users),
))
@staticmethod
def from_reader(reader):
_photo = reader.tgread_object()
reader.read_int()
_users = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_users.append(_x)
return Photo(photo=_photo, users=_users)
class Photos(TLObject):
CONSTRUCTOR_ID = 0x8dca6aa5
SUBCLASS_OF_ID = 0x27cfb967
def __init__(self, photos, users):
"""
:param list[Photo] photos:
:param list[User] users:
Constructor for photos.Photos: Instance of either Photos, PhotosSlice.
"""
super().__init__()
self.photos = photos
self.users = users
def to_dict(self):
return {
'_': 'Photos',
'photos': [] if self.photos is None else [None if x is None else x.to_dict() for x in self.photos],
'users': [] if self.users is None else [None if x is None else x.to_dict() for x in self.users]
}
def __bytes__(self):
return b''.join((
b'\xa5j\xca\x8d',
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.photos)),b''.join(bytes(x) for x in self.photos),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.users)),b''.join(bytes(x) for x in self.users),
))
@staticmethod
def from_reader(reader):
reader.read_int()
_photos = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_photos.append(_x)
reader.read_int()
_users = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_users.append(_x)
return Photos(photos=_photos, users=_users)
class PhotosSlice(TLObject):
CONSTRUCTOR_ID = 0x15051f54
SUBCLASS_OF_ID = 0x27cfb967
def __init__(self, count, photos, users):
"""
:param int count:
:param list[Photo] photos:
:param list[User] users:
Constructor for photos.Photos: Instance of either Photos, PhotosSlice.
"""
super().__init__()
self.count = count
self.photos = photos
self.users = users
def to_dict(self):
return {
'_': 'PhotosSlice',
'count': self.count,
'photos': [] if self.photos is None else [None if x is None else x.to_dict() for x in self.photos],
'users': [] if self.users is None else [None if x is None else x.to_dict() for x in self.users]
}
def __bytes__(self):
return b''.join((
b'T\x1f\x05\x15',
struct.pack('<i', self.count),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.photos)),b''.join(bytes(x) for x in self.photos),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.users)),b''.join(bytes(x) for x in self.users),
))
@staticmethod
def from_reader(reader):
_count = reader.read_int()
reader.read_int()
_photos = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_photos.append(_x)
reader.read_int()
_users = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_users.append(_x)
return PhotosSlice(count=_count, photos=_photos, users=_users)

View File

@ -0,0 +1,224 @@
"""File generated by TLObjects' generator. All changes will be ERASED"""
from ...tl.tlobject import TLObject
import os
import struct
class FileGif(TLObject):
CONSTRUCTOR_ID = 0xcae1aadf
SUBCLASS_OF_ID = 0xf3a1e6f3
def __init__(self):
super().__init__()
def to_dict(self):
return {
'_': 'FileGif'
}
def __bytes__(self):
return b''.join((
b'\xdf\xaa\xe1\xca',
))
@staticmethod
def from_reader(reader):
return FileGif()
class FileJpeg(TLObject):
CONSTRUCTOR_ID = 0x7efe0e
SUBCLASS_OF_ID = 0xf3a1e6f3
def __init__(self):
super().__init__()
def to_dict(self):
return {
'_': 'FileJpeg'
}
def __bytes__(self):
return b''.join((
b'\x0e\xfe~\x00',
))
@staticmethod
def from_reader(reader):
return FileJpeg()
class FileMov(TLObject):
CONSTRUCTOR_ID = 0x4b09ebbc
SUBCLASS_OF_ID = 0xf3a1e6f3
def __init__(self):
super().__init__()
def to_dict(self):
return {
'_': 'FileMov'
}
def __bytes__(self):
return b''.join((
b'\xbc\xeb\tK',
))
@staticmethod
def from_reader(reader):
return FileMov()
class FileMp3(TLObject):
CONSTRUCTOR_ID = 0x528a0677
SUBCLASS_OF_ID = 0xf3a1e6f3
def __init__(self):
super().__init__()
def to_dict(self):
return {
'_': 'FileMp3'
}
def __bytes__(self):
return b''.join((
b'w\x06\x8aR',
))
@staticmethod
def from_reader(reader):
return FileMp3()
class FileMp4(TLObject):
CONSTRUCTOR_ID = 0xb3cea0e4
SUBCLASS_OF_ID = 0xf3a1e6f3
def __init__(self):
super().__init__()
def to_dict(self):
return {
'_': 'FileMp4'
}
def __bytes__(self):
return b''.join((
b'\xe4\xa0\xce\xb3',
))
@staticmethod
def from_reader(reader):
return FileMp4()
class FilePartial(TLObject):
CONSTRUCTOR_ID = 0x40bc6f52
SUBCLASS_OF_ID = 0xf3a1e6f3
def __init__(self):
super().__init__()
def to_dict(self):
return {
'_': 'FilePartial'
}
def __bytes__(self):
return b''.join((
b'Ro\xbc@',
))
@staticmethod
def from_reader(reader):
return FilePartial()
class FilePdf(TLObject):
CONSTRUCTOR_ID = 0xae1e508d
SUBCLASS_OF_ID = 0xf3a1e6f3
def __init__(self):
super().__init__()
def to_dict(self):
return {
'_': 'FilePdf'
}
def __bytes__(self):
return b''.join((
b'\x8dP\x1e\xae',
))
@staticmethod
def from_reader(reader):
return FilePdf()
class FilePng(TLObject):
CONSTRUCTOR_ID = 0xa4f63c0
SUBCLASS_OF_ID = 0xf3a1e6f3
def __init__(self):
super().__init__()
def to_dict(self):
return {
'_': 'FilePng'
}
def __bytes__(self):
return b''.join((
b'\xc0cO\n',
))
@staticmethod
def from_reader(reader):
return FilePng()
class FileUnknown(TLObject):
CONSTRUCTOR_ID = 0xaa963b05
SUBCLASS_OF_ID = 0xf3a1e6f3
def __init__(self):
super().__init__()
def to_dict(self):
return {
'_': 'FileUnknown'
}
def __bytes__(self):
return b''.join((
b'\x05;\x96\xaa',
))
@staticmethod
def from_reader(reader):
return FileUnknown()
class FileWebp(TLObject):
CONSTRUCTOR_ID = 0x1081464c
SUBCLASS_OF_ID = 0xf3a1e6f3
def __init__(self):
super().__init__()
def to_dict(self):
return {
'_': 'FileWebp'
}
def __bytes__(self):
return b''.join((
b'LF\x81\x10',
))
@staticmethod
def from_reader(reader):
return FileWebp()

View File

@ -0,0 +1,525 @@
"""File generated by TLObjects' generator. All changes will be ERASED"""
from ...tl.tlobject import TLObject
import os
import struct
class ChannelDifference(TLObject):
CONSTRUCTOR_ID = 0x2064674e
SUBCLASS_OF_ID = 0x29896f5d
def __init__(self, pts, new_messages, other_updates, chats, users, final=None, timeout=None):
"""
:param bool | None final:
:param int pts:
:param int | None timeout:
:param list[Message] new_messages:
:param list[Update] other_updates:
:param list[Chat] chats:
:param list[User] users:
Constructor for updates.ChannelDifference: Instance of either ChannelDifferenceEmpty, ChannelDifferenceTooLong, ChannelDifference.
"""
super().__init__()
self.final = final
self.pts = pts
self.timeout = timeout
self.new_messages = new_messages
self.other_updates = other_updates
self.chats = chats
self.users = users
def to_dict(self):
return {
'_': 'ChannelDifference',
'final': self.final,
'pts': self.pts,
'timeout': self.timeout,
'new_messages': [] if self.new_messages is None else [None if x is None else x.to_dict() for x in self.new_messages],
'other_updates': [] if self.other_updates is None else [None if x is None else x.to_dict() for x in self.other_updates],
'chats': [] if self.chats is None else [None if x is None else x.to_dict() for x in self.chats],
'users': [] if self.users is None else [None if x is None else x.to_dict() for x in self.users]
}
def __bytes__(self):
return b''.join((
b'Ngd ',
struct.pack('<I', (0 if self.final is None or self.final is False else 1) | (0 if self.timeout is None or self.timeout is False else 2)),
struct.pack('<i', self.pts),
b'' if self.timeout is None or self.timeout is False else (struct.pack('<i', self.timeout)),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.new_messages)),b''.join(bytes(x) for x in self.new_messages),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.other_updates)),b''.join(bytes(x) for x in self.other_updates),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.chats)),b''.join(bytes(x) for x in self.chats),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.users)),b''.join(bytes(x) for x in self.users),
))
@staticmethod
def from_reader(reader):
flags = reader.read_int()
_final = bool(flags & 1)
_pts = reader.read_int()
if flags & 2:
_timeout = reader.read_int()
else:
_timeout = None
reader.read_int()
_new_messages = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_new_messages.append(_x)
reader.read_int()
_other_updates = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_other_updates.append(_x)
reader.read_int()
_chats = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_chats.append(_x)
reader.read_int()
_users = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_users.append(_x)
return ChannelDifference(pts=_pts, new_messages=_new_messages, other_updates=_other_updates, chats=_chats, users=_users, final=_final, timeout=_timeout)
class ChannelDifferenceEmpty(TLObject):
CONSTRUCTOR_ID = 0x3e11affb
SUBCLASS_OF_ID = 0x29896f5d
def __init__(self, pts, final=None, timeout=None):
"""
:param bool | None final:
:param int pts:
:param int | None timeout:
Constructor for updates.ChannelDifference: Instance of either ChannelDifferenceEmpty, ChannelDifferenceTooLong, ChannelDifference.
"""
super().__init__()
self.final = final
self.pts = pts
self.timeout = timeout
def to_dict(self):
return {
'_': 'ChannelDifferenceEmpty',
'final': self.final,
'pts': self.pts,
'timeout': self.timeout
}
def __bytes__(self):
return b''.join((
b'\xfb\xaf\x11>',
struct.pack('<I', (0 if self.final is None or self.final is False else 1) | (0 if self.timeout is None or self.timeout is False else 2)),
struct.pack('<i', self.pts),
b'' if self.timeout is None or self.timeout is False else (struct.pack('<i', self.timeout)),
))
@staticmethod
def from_reader(reader):
flags = reader.read_int()
_final = bool(flags & 1)
_pts = reader.read_int()
if flags & 2:
_timeout = reader.read_int()
else:
_timeout = None
return ChannelDifferenceEmpty(pts=_pts, final=_final, timeout=_timeout)
class ChannelDifferenceTooLong(TLObject):
CONSTRUCTOR_ID = 0x6a9d7b35
SUBCLASS_OF_ID = 0x29896f5d
def __init__(self, pts, top_message, read_inbox_max_id, read_outbox_max_id, unread_count, unread_mentions_count, messages, chats, users, final=None, timeout=None):
"""
:param bool | None final:
:param int pts:
:param int | None timeout:
:param int top_message:
:param int read_inbox_max_id:
:param int read_outbox_max_id:
:param int unread_count:
:param int unread_mentions_count:
:param list[Message] messages:
:param list[Chat] chats:
:param list[User] users:
Constructor for updates.ChannelDifference: Instance of either ChannelDifferenceEmpty, ChannelDifferenceTooLong, ChannelDifference.
"""
super().__init__()
self.final = final
self.pts = pts
self.timeout = timeout
self.top_message = top_message
self.read_inbox_max_id = read_inbox_max_id
self.read_outbox_max_id = read_outbox_max_id
self.unread_count = unread_count
self.unread_mentions_count = unread_mentions_count
self.messages = messages
self.chats = chats
self.users = users
def to_dict(self):
return {
'_': 'ChannelDifferenceTooLong',
'final': self.final,
'pts': self.pts,
'timeout': self.timeout,
'top_message': self.top_message,
'read_inbox_max_id': self.read_inbox_max_id,
'read_outbox_max_id': self.read_outbox_max_id,
'unread_count': self.unread_count,
'unread_mentions_count': self.unread_mentions_count,
'messages': [] if self.messages is None else [None if x is None else x.to_dict() for x in self.messages],
'chats': [] if self.chats is None else [None if x is None else x.to_dict() for x in self.chats],
'users': [] if self.users is None else [None if x is None else x.to_dict() for x in self.users]
}
def __bytes__(self):
return b''.join((
b'5{\x9dj',
struct.pack('<I', (0 if self.final is None or self.final is False else 1) | (0 if self.timeout is None or self.timeout is False else 2)),
struct.pack('<i', self.pts),
b'' if self.timeout is None or self.timeout is False else (struct.pack('<i', self.timeout)),
struct.pack('<i', self.top_message),
struct.pack('<i', self.read_inbox_max_id),
struct.pack('<i', self.read_outbox_max_id),
struct.pack('<i', self.unread_count),
struct.pack('<i', self.unread_mentions_count),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.messages)),b''.join(bytes(x) for x in self.messages),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.chats)),b''.join(bytes(x) for x in self.chats),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.users)),b''.join(bytes(x) for x in self.users),
))
@staticmethod
def from_reader(reader):
flags = reader.read_int()
_final = bool(flags & 1)
_pts = reader.read_int()
if flags & 2:
_timeout = reader.read_int()
else:
_timeout = None
_top_message = reader.read_int()
_read_inbox_max_id = reader.read_int()
_read_outbox_max_id = reader.read_int()
_unread_count = reader.read_int()
_unread_mentions_count = reader.read_int()
reader.read_int()
_messages = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_messages.append(_x)
reader.read_int()
_chats = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_chats.append(_x)
reader.read_int()
_users = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_users.append(_x)
return ChannelDifferenceTooLong(pts=_pts, top_message=_top_message, read_inbox_max_id=_read_inbox_max_id, read_outbox_max_id=_read_outbox_max_id, unread_count=_unread_count, unread_mentions_count=_unread_mentions_count, messages=_messages, chats=_chats, users=_users, final=_final, timeout=_timeout)
class Difference(TLObject):
CONSTRUCTOR_ID = 0xf49ca0
SUBCLASS_OF_ID = 0x20482874
def __init__(self, new_messages, new_encrypted_messages, other_updates, chats, users, state):
"""
:param list[Message] new_messages:
:param list[EncryptedMessage] new_encrypted_messages:
:param list[Update] other_updates:
:param list[Chat] chats:
:param list[User] users:
:param updates.State state:
Constructor for updates.Difference: Instance of either DifferenceEmpty, Difference, DifferenceSlice, DifferenceTooLong.
"""
super().__init__()
self.new_messages = new_messages
self.new_encrypted_messages = new_encrypted_messages
self.other_updates = other_updates
self.chats = chats
self.users = users
self.state = state
def to_dict(self):
return {
'_': 'Difference',
'new_messages': [] if self.new_messages is None else [None if x is None else x.to_dict() for x in self.new_messages],
'new_encrypted_messages': [] if self.new_encrypted_messages is None else [None if x is None else x.to_dict() for x in self.new_encrypted_messages],
'other_updates': [] if self.other_updates is None else [None if x is None else x.to_dict() for x in self.other_updates],
'chats': [] if self.chats is None else [None if x is None else x.to_dict() for x in self.chats],
'users': [] if self.users is None else [None if x is None else x.to_dict() for x in self.users],
'state': None if self.state is None else self.state.to_dict()
}
def __bytes__(self):
return b''.join((
b'\xa0\x9c\xf4\x00',
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.new_messages)),b''.join(bytes(x) for x in self.new_messages),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.new_encrypted_messages)),b''.join(bytes(x) for x in self.new_encrypted_messages),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.other_updates)),b''.join(bytes(x) for x in self.other_updates),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.chats)),b''.join(bytes(x) for x in self.chats),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.users)),b''.join(bytes(x) for x in self.users),
bytes(self.state),
))
@staticmethod
def from_reader(reader):
reader.read_int()
_new_messages = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_new_messages.append(_x)
reader.read_int()
_new_encrypted_messages = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_new_encrypted_messages.append(_x)
reader.read_int()
_other_updates = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_other_updates.append(_x)
reader.read_int()
_chats = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_chats.append(_x)
reader.read_int()
_users = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_users.append(_x)
_state = reader.tgread_object()
return Difference(new_messages=_new_messages, new_encrypted_messages=_new_encrypted_messages, other_updates=_other_updates, chats=_chats, users=_users, state=_state)
class DifferenceEmpty(TLObject):
CONSTRUCTOR_ID = 0x5d75a138
SUBCLASS_OF_ID = 0x20482874
def __init__(self, date, seq):
"""
:param datetime.datetime | None date:
:param int seq:
Constructor for updates.Difference: Instance of either DifferenceEmpty, Difference, DifferenceSlice, DifferenceTooLong.
"""
super().__init__()
self.date = date
self.seq = seq
def to_dict(self):
return {
'_': 'DifferenceEmpty',
'date': self.date,
'seq': self.seq
}
def __bytes__(self):
return b''.join((
b'8\xa1u]',
TLObject.serialize_datetime(self.date),
struct.pack('<i', self.seq),
))
@staticmethod
def from_reader(reader):
_date = reader.tgread_date()
_seq = reader.read_int()
return DifferenceEmpty(date=_date, seq=_seq)
class DifferenceSlice(TLObject):
CONSTRUCTOR_ID = 0xa8fb1981
SUBCLASS_OF_ID = 0x20482874
def __init__(self, new_messages, new_encrypted_messages, other_updates, chats, users, intermediate_state):
"""
:param list[Message] new_messages:
:param list[EncryptedMessage] new_encrypted_messages:
:param list[Update] other_updates:
:param list[Chat] chats:
:param list[User] users:
:param updates.State intermediate_state:
Constructor for updates.Difference: Instance of either DifferenceEmpty, Difference, DifferenceSlice, DifferenceTooLong.
"""
super().__init__()
self.new_messages = new_messages
self.new_encrypted_messages = new_encrypted_messages
self.other_updates = other_updates
self.chats = chats
self.users = users
self.intermediate_state = intermediate_state
def to_dict(self):
return {
'_': 'DifferenceSlice',
'new_messages': [] if self.new_messages is None else [None if x is None else x.to_dict() for x in self.new_messages],
'new_encrypted_messages': [] if self.new_encrypted_messages is None else [None if x is None else x.to_dict() for x in self.new_encrypted_messages],
'other_updates': [] if self.other_updates is None else [None if x is None else x.to_dict() for x in self.other_updates],
'chats': [] if self.chats is None else [None if x is None else x.to_dict() for x in self.chats],
'users': [] if self.users is None else [None if x is None else x.to_dict() for x in self.users],
'intermediate_state': None if self.intermediate_state is None else self.intermediate_state.to_dict()
}
def __bytes__(self):
return b''.join((
b'\x81\x19\xfb\xa8',
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.new_messages)),b''.join(bytes(x) for x in self.new_messages),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.new_encrypted_messages)),b''.join(bytes(x) for x in self.new_encrypted_messages),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.other_updates)),b''.join(bytes(x) for x in self.other_updates),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.chats)),b''.join(bytes(x) for x in self.chats),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.users)),b''.join(bytes(x) for x in self.users),
bytes(self.intermediate_state),
))
@staticmethod
def from_reader(reader):
reader.read_int()
_new_messages = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_new_messages.append(_x)
reader.read_int()
_new_encrypted_messages = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_new_encrypted_messages.append(_x)
reader.read_int()
_other_updates = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_other_updates.append(_x)
reader.read_int()
_chats = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_chats.append(_x)
reader.read_int()
_users = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_users.append(_x)
_intermediate_state = reader.tgread_object()
return DifferenceSlice(new_messages=_new_messages, new_encrypted_messages=_new_encrypted_messages, other_updates=_other_updates, chats=_chats, users=_users, intermediate_state=_intermediate_state)
class DifferenceTooLong(TLObject):
CONSTRUCTOR_ID = 0x4afe8f6d
SUBCLASS_OF_ID = 0x20482874
def __init__(self, pts):
"""
:param int pts:
Constructor for updates.Difference: Instance of either DifferenceEmpty, Difference, DifferenceSlice, DifferenceTooLong.
"""
super().__init__()
self.pts = pts
def to_dict(self):
return {
'_': 'DifferenceTooLong',
'pts': self.pts
}
def __bytes__(self):
return b''.join((
b'm\x8f\xfeJ',
struct.pack('<i', self.pts),
))
@staticmethod
def from_reader(reader):
_pts = reader.read_int()
return DifferenceTooLong(pts=_pts)
class State(TLObject):
CONSTRUCTOR_ID = 0xa56c2a3e
SUBCLASS_OF_ID = 0x23df1a01
def __init__(self, pts, qts, date, seq, unread_count):
"""
:param int pts:
:param int qts:
:param datetime.datetime | None date:
:param int seq:
:param int unread_count:
Constructor for updates.State: Instance of State.
"""
super().__init__()
self.pts = pts
self.qts = qts
self.date = date
self.seq = seq
self.unread_count = unread_count
def to_dict(self):
return {
'_': 'State',
'pts': self.pts,
'qts': self.qts,
'date': self.date,
'seq': self.seq,
'unread_count': self.unread_count
}
def __bytes__(self):
return b''.join((
b'>*l\xa5',
struct.pack('<i', self.pts),
struct.pack('<i', self.qts),
TLObject.serialize_datetime(self.date),
struct.pack('<i', self.seq),
struct.pack('<i', self.unread_count),
))
@staticmethod
def from_reader(reader):
_pts = reader.read_int()
_qts = reader.read_int()
_date = reader.tgread_date()
_seq = reader.read_int()
_unread_count = reader.read_int()
return State(pts=_pts, qts=_qts, date=_date, seq=_seq, unread_count=_unread_count)

219
telethon/tl/types/upload.py Normal file
View File

@ -0,0 +1,219 @@
"""File generated by TLObjects' generator. All changes will be ERASED"""
from ...tl.tlobject import TLObject
import os
import struct
class CdnFile(TLObject):
CONSTRUCTOR_ID = 0xa99fca4f
SUBCLASS_OF_ID = 0xf5ccf928
def __init__(self, bytes):
"""
:param bytes bytes:
Constructor for upload.CdnFile: Instance of either CdnFileReuploadNeeded, CdnFile.
"""
super().__init__()
self.bytes = bytes
def to_dict(self):
return {
'_': 'CdnFile',
'bytes': self.bytes
}
def __bytes__(self):
return b''.join((
b'O\xca\x9f\xa9',
TLObject.serialize_bytes(self.bytes),
))
@staticmethod
def from_reader(reader):
_bytes = reader.tgread_bytes()
return CdnFile(bytes=_bytes)
class CdnFileReuploadNeeded(TLObject):
CONSTRUCTOR_ID = 0xeea8e46e
SUBCLASS_OF_ID = 0xf5ccf928
def __init__(self, request_token):
"""
:param bytes request_token:
Constructor for upload.CdnFile: Instance of either CdnFileReuploadNeeded, CdnFile.
"""
super().__init__()
self.request_token = request_token
def to_dict(self):
return {
'_': 'CdnFileReuploadNeeded',
'request_token': self.request_token
}
def __bytes__(self):
return b''.join((
b'n\xe4\xa8\xee',
TLObject.serialize_bytes(self.request_token),
))
@staticmethod
def from_reader(reader):
_request_token = reader.tgread_bytes()
return CdnFileReuploadNeeded(request_token=_request_token)
class File(TLObject):
CONSTRUCTOR_ID = 0x96a18d5
SUBCLASS_OF_ID = 0x6c9bd728
def __init__(self, type, mtime, bytes):
"""
:param storage.FileType type:
:param int mtime:
:param bytes bytes:
Constructor for upload.File: Instance of either File, FileCdnRedirect.
"""
super().__init__()
self.type = type
self.mtime = mtime
self.bytes = bytes
def to_dict(self):
return {
'_': 'File',
'type': None if self.type is None else self.type.to_dict(),
'mtime': self.mtime,
'bytes': self.bytes
}
def __bytes__(self):
return b''.join((
b'\xd5\x18j\t',
bytes(self.type),
struct.pack('<i', self.mtime),
TLObject.serialize_bytes(self.bytes),
))
@staticmethod
def from_reader(reader):
_type = reader.tgread_object()
_mtime = reader.read_int()
_bytes = reader.tgread_bytes()
return File(type=_type, mtime=_mtime, bytes=_bytes)
class FileCdnRedirect(TLObject):
CONSTRUCTOR_ID = 0xea52fe5a
SUBCLASS_OF_ID = 0x6c9bd728
def __init__(self, dc_id, file_token, encryption_key, encryption_iv, cdn_file_hashes):
"""
:param int dc_id:
:param bytes file_token:
:param bytes encryption_key:
:param bytes encryption_iv:
:param list[CdnFileHash] cdn_file_hashes:
Constructor for upload.File: Instance of either File, FileCdnRedirect.
"""
super().__init__()
self.dc_id = dc_id
self.file_token = file_token
self.encryption_key = encryption_key
self.encryption_iv = encryption_iv
self.cdn_file_hashes = cdn_file_hashes
def to_dict(self):
return {
'_': 'FileCdnRedirect',
'dc_id': self.dc_id,
'file_token': self.file_token,
'encryption_key': self.encryption_key,
'encryption_iv': self.encryption_iv,
'cdn_file_hashes': [] if self.cdn_file_hashes is None else [None if x is None else x.to_dict() for x in self.cdn_file_hashes]
}
def __bytes__(self):
return b''.join((
b'Z\xfeR\xea',
struct.pack('<i', self.dc_id),
TLObject.serialize_bytes(self.file_token),
TLObject.serialize_bytes(self.encryption_key),
TLObject.serialize_bytes(self.encryption_iv),
b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.cdn_file_hashes)),b''.join(bytes(x) for x in self.cdn_file_hashes),
))
@staticmethod
def from_reader(reader):
_dc_id = reader.read_int()
_file_token = reader.tgread_bytes()
_encryption_key = reader.tgread_bytes()
_encryption_iv = reader.tgread_bytes()
reader.read_int()
_cdn_file_hashes = []
for _ in range(reader.read_int()):
_x = reader.tgread_object()
_cdn_file_hashes.append(_x)
return FileCdnRedirect(dc_id=_dc_id, file_token=_file_token, encryption_key=_encryption_key, encryption_iv=_encryption_iv, cdn_file_hashes=_cdn_file_hashes)
class WebFile(TLObject):
CONSTRUCTOR_ID = 0x21e753bc
SUBCLASS_OF_ID = 0x68f17f51
def __init__(self, size, mime_type, file_type, mtime, bytes):
"""
:param int size:
:param str mime_type:
:param storage.FileType file_type:
:param int mtime:
:param bytes bytes:
Constructor for upload.WebFile: Instance of WebFile.
"""
super().__init__()
self.size = size
self.mime_type = mime_type
self.file_type = file_type
self.mtime = mtime
self.bytes = bytes
def to_dict(self):
return {
'_': 'WebFile',
'size': self.size,
'mime_type': self.mime_type,
'file_type': None if self.file_type is None else self.file_type.to_dict(),
'mtime': self.mtime,
'bytes': self.bytes
}
def __bytes__(self):
return b''.join((
b'\xbcS\xe7!',
struct.pack('<i', self.size),
TLObject.serialize_bytes(self.mime_type),
bytes(self.file_type),
struct.pack('<i', self.mtime),
TLObject.serialize_bytes(self.bytes),
))
@staticmethod
def from_reader(reader):
_size = reader.read_int()
_mime_type = reader.tgread_string()
_file_type = reader.tgread_object()
_mtime = reader.read_int()
_bytes = reader.tgread_bytes()
return WebFile(size=_size, mime_type=_mime_type, file_type=_file_type, mtime=_mtime, bytes=_bytes)

View File

@ -340,6 +340,8 @@ class NewMessage(_EventBuilder):
Returns ``None`` if the message was incoming,
or the edited message otherwise.
"""
if self.message.fwd_from:
return None
if not self.message.out:
if not isinstance(self.message.to_id, types.PeerUser):
return None
@ -482,6 +484,69 @@ class NewMessage(_EventBuilder):
if isinstance(doc, types.Document):
return doc
def _document_by_attribute(self, kind, condition=None):
"""
Helper method to return the document only if it has an attribute
that's an instance of the given kind, and passes the condition.
"""
doc = self.document
if doc:
for attr in doc.attributes:
if isinstance(attr, kind):
if not condition or condition(doc):
return doc
@property
def audio(self):
"""
If the message media is a document with an Audio attribute,
this returns the (:obj:`Document`) object.
"""
return self._document_by_attribute(types.DocumentAttributeAudio,
lambda attr: not attr.voice)
@property
def voice(self):
"""
If the message media is a document with a Voice attribute,
this returns the (:obj:`Document`) object.
"""
return self._document_by_attribute(types.DocumentAttributeAudio,
lambda attr: attr.voice)
@property
def video(self):
"""
If the message media is a document with a Video attribute,
this returns the (:obj:`Document`) object.
"""
return self._document_by_attribute(types.DocumentAttributeVideo)
@property
def video_note(self):
"""
If the message media is a document with a Video attribute,
this returns the (:obj:`Document`) object.
"""
return self._document_by_attribute(types.DocumentAttributeVideo,
lambda attr: attr.round_message)
@property
def gif(self):
"""
If the message media is a document with an Animated attribute,
this returns the (:obj:`Document`) object.
"""
return self._document_by_attribute(types.DocumentAttributeAnimated)
@property
def sticker(self):
"""
If the message media is a document with a Sticker attribute,
this returns the (:obj:`Document`) object.
"""
return self._document_by_attribute(types.DocumentAttributeSticker)
@property
def out(self):
"""
@ -518,37 +583,37 @@ class ChatAction(_EventBuilder):
msg = update.message
action = update.message.action
if isinstance(action, types.MessageActionChatJoinedByLink):
event = ChatAction.Event(msg.to_id,
event = ChatAction.Event(msg,
added_by=True,
users=msg.from_id)
elif isinstance(action, types.MessageActionChatAddUser):
event = ChatAction.Event(msg.to_id,
event = ChatAction.Event(msg,
added_by=msg.from_id or True,
users=action.users)
elif isinstance(action, types.MessageActionChatDeleteUser):
event = ChatAction.Event(msg.to_id,
event = ChatAction.Event(msg,
kicked_by=msg.from_id or True,
users=action.user_id)
elif isinstance(action, types.MessageActionChatCreate):
event = ChatAction.Event(msg.to_id,
event = ChatAction.Event(msg,
users=action.users,
created=True,
new_title=action.title)
elif isinstance(action, types.MessageActionChannelCreate):
event = ChatAction.Event(msg.to_id,
event = ChatAction.Event(msg,
created=True,
users=msg.from_id,
new_title=action.title)
elif isinstance(action, types.MessageActionChatEditTitle):
event = ChatAction.Event(msg.to_id,
event = ChatAction.Event(msg,
users=msg.from_id,
new_title=action.title)
elif isinstance(action, types.MessageActionChatEditPhoto):
event = ChatAction.Event(msg.to_id,
event = ChatAction.Event(msg,
users=msg.from_id,
new_photo=action.photo)
elif isinstance(action, types.MessageActionChatDeletePhoto):
event = ChatAction.Event(msg.to_id,
event = ChatAction.Event(msg,
users=msg.from_id,
new_photo=True)
else:
@ -591,10 +656,16 @@ class ChatAction(_EventBuilder):
new_title (:obj:`bool`, optional):
The new title string for the chat, if applicable.
"""
def __init__(self, chat_peer, new_pin=None, new_photo=None,
def __init__(self, where, new_pin=None, new_photo=None,
added_by=None, kicked_by=None, created=None,
users=None, new_title=None):
super().__init__(chat_peer=chat_peer, msg_id=new_pin)
if isinstance(where, types.MessageService):
self.action_message = where
where = where.to_id
else:
self.action_message = None
super().__init__(chat_peer=where, msg_id=new_pin)
self.new_pin = isinstance(new_pin, int)
self._pinned_message = new_pin
@ -626,6 +697,42 @@ class ChatAction(_EventBuilder):
self._input_users = None
self.new_title = new_title
async def respond(self, *args, **kwargs):
"""
Responds to the chat action message (not as a reply).
Shorthand for ``client.send_message(event.chat, ...)``.
"""
return await self._client.send_message(self.input_chat,
*args, **kwargs)
async def reply(self, *args, **kwargs):
"""
Replies to the chat action message (as a reply). Shorthand for
``client.send_message(event.chat, ..., reply_to=event.message.id)``.
Has the same effect as ``.respond()`` if there is no message.
"""
if not self.action_message:
return self.respond(*args, **kwargs)
kwargs['reply_to'] = self.action_message.id
return await self._client.send_message(self.input_chat,
*args, **kwargs)
async def delete(self, *args, **kwargs):
"""
Deletes the chat action message. You're responsible for checking
whether you have the permission to do so, or to except the error
otherwise. This is a shorthand for
``client.delete_messages(event.chat, event.message, ...)``.
Does nothing if no message action triggered this event.
"""
if self.action_message:
return await self._client.delete_messages(self.input_chat,
[self.action_message],
*args, **kwargs)
@property
async def pinned_message(self):
"""
@ -905,10 +1012,10 @@ class MessageDeleted(_EventBuilder):
class Event(_EventCommon):
def __init__(self, deleted_ids, peer):
super().__init__(
types.Message((deleted_ids or [0])[0], peer, None, '')
chat_peer=peer, msg_id=(deleted_ids or [0])[0]
)
self.deleted_id = None if not deleted_ids else deleted_ids[0]
self.deleted_ids = self.deleted_ids
self.deleted_ids = deleted_ids
class StopPropagation(Exception):

View File

@ -68,6 +68,7 @@ class MtProtoSender:
def disconnect(self):
"""Disconnects from the server."""
__log__.info('Disconnecting MtProtoSender...')
self.connection.close()
self._clear_all_pending()
@ -245,6 +246,7 @@ class MtProtoSender:
if r:
r.result = True # Telegram won't send this value
r.confirm_received.set()
__log__.debug('Confirmed %s through ack', type(r).__name__)
return True
@ -253,6 +255,7 @@ class MtProtoSender:
if r:
r.result = obj
r.confirm_received.set()
__log__.debug('Confirmed %s through salt', type(r).__name__)
# If the object isn't any of the above, then it should be an Update.
self.session.process_entities(obj)
@ -309,6 +312,7 @@ class MtProtoSender:
"""
for r in self._pending_receive.values():
r.request.confirm_received.set()
__log__.info('Abruptly confirming %s', type(r).__name__)
self._pending_receive.clear()
async def _resend_request(self, msg_id):
@ -339,6 +343,7 @@ class MtProtoSender:
if request:
request.result = pong
request.confirm_received.set()
__log__.debug('Confirmed %s through pong', type(request).__name__)
return True
@ -490,6 +495,9 @@ class MtProtoSender:
if request:
request.rpc_error = error
request.confirm_received.set()
__log__.debug('Confirmed %s through error %s',
type(request).__name__, error)
# else TODO Where should this error be reported?
# Read may be async. Can an error not-belong to a request?
return True # All contents were read okay
@ -505,6 +513,10 @@ class MtProtoSender:
self.session.process_entities(request.result)
request.confirm_received.set()
__log__.debug(
'Confirmed %s through normal result %s',
type(request).__name__, type(request.result).__name__
)
return True
# If it's really a result for RPC from previous connection

View File

@ -1,9 +1,8 @@
from enum import Enum
from .. import utils
from .abstract import Session
from .. import utils
from ..tl import TLObject
from ..tl.types import (
PeerUser, PeerChat, PeerChannel,
InputPeerUser, InputPeerChat, InputPeerChannel,
@ -148,10 +147,19 @@ class MemorySession(Session):
except StopIteration:
pass
def get_entity_rows_by_id(self, id):
def get_entity_rows_by_id(self, id, exact=True):
try:
return next((id, hash) for found_id, hash, _, _, _
in self._entities if found_id == id)
if exact:
return next((id, hash) for found_id, hash, _, _, _
in self._entities if found_id == id)
else:
ids = (
utils.get_peer_id(PeerUser(id)),
utils.get_peer_id(PeerChat(id)),
utils.get_peer_id(PeerChannel(id))
)
return next((id, hash) for found_id, hash, _, _, _
in self._entities if found_id in ids)
except StopIteration:
pass
@ -167,6 +175,9 @@ class MemorySession(Session):
# Not a TLObject or can't be cast into InputPeer
if isinstance(key, TLObject):
key = utils.get_peer_id(key)
exact = True
else:
exact = not isinstance(key, int) or key < 0
result = None
if isinstance(key, str):
@ -178,8 +189,8 @@ class MemorySession(Session):
if username:
result = self.get_entity_rows_by_username(username)
if isinstance(key, int):
result = self.get_entity_rows_by_id(key)
elif isinstance(key, int):
result = self.get_entity_rows_by_id(key, exact)
if not result and isinstance(key, str):
result = self.get_entity_rows_by_name(key)

View File

@ -1,15 +1,16 @@
try:
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, String, Integer, BLOB, orm
from sqlalchemy import Column, String, Integer, LargeBinary, orm
import sqlalchemy as sql
except ImportError:
sql = None
pass
from ..crypto import AuthKey
from ..tl.types import InputPhoto, InputDocument
from .memory import MemorySession, _SentFileType
from .. import utils
from ..crypto import AuthKey
from ..tl.types import (
InputPhoto, InputDocument, PeerUser, PeerChat, PeerChannel
)
LATEST_VERSION = 1
@ -59,7 +60,7 @@ class AlchemySessionContainer:
dc_id = Column(Integer, primary_key=True)
server_address = Column(String)
port = Column(Integer)
auth_key = Column(BLOB)
auth_key = Column(LargeBinary)
class Entity(Base):
query = db.query_property()
@ -77,7 +78,7 @@ class AlchemySessionContainer:
__tablename__ = '{prefix}sent_files'.format(prefix=prefix)
session_id = Column(String, primary_key=True)
md5_digest = Column(BLOB, primary_key=True)
md5_digest = Column(LargeBinary, primary_key=True)
file_size = Column(Integer, primary_key=True)
type = Column(Integer, primary_key=True)
id = Column(Integer)
@ -158,8 +159,9 @@ class AlchemySession(MemorySession):
self.db.merge(new)
def _db_query(self, dbclass, *args):
return dbclass.query.filter(dbclass.session_id == self.session_id,
*args)
return dbclass.query.filter(
dbclass.session_id == self.session_id, *args
)
def save(self):
self.container.save()
@ -189,21 +191,31 @@ class AlchemySession(MemorySession):
def get_entity_rows_by_phone(self, key):
row = self._db_query(self.Entity,
self.Entity.phone == key).one_or_none()
return row.id, row.hash if row else None
return (row.id, row.hash) if row else None
def get_entity_rows_by_username(self, key):
row = self._db_query(self.Entity,
self.Entity.username == key).one_or_none()
return row.id, row.hash if row else None
return (row.id, row.hash) if row else None
def get_entity_rows_by_name(self, key):
row = self._db_query(self.Entity,
self.Entity.name == key).one_or_none()
return row.id, row.hash if row else None
return (row.id, row.hash) if row else None
def get_entity_rows_by_id(self, key):
row = self._db_query(self.Entity, self.Entity.id == key).one_or_none()
return row.id, row.hash if row else None
def get_entity_rows_by_id(self, key, exact=True):
if exact:
query = self._db_query(self.Entity, self.Entity.id == key)
else:
ids = (
utils.get_peer_id(PeerUser(key)),
utils.get_peer_id(PeerChat(key)),
utils.get_peer_id(PeerChannel(key))
)
query = self._db_query(self.Entity, self.Entity.id in ids)
row = query.one_or_none()
return (row.id, row.hash) if row else None
def get_file(self, md5_digest, file_size, cls):
row = self._db_query(self.SentFile,
@ -211,7 +223,7 @@ class AlchemySession(MemorySession):
self.SentFile.file_size == file_size,
self.SentFile.type == _SentFileType.from_type(
cls).value).one_or_none()
return row.id, row.hash if row else None
return (row.id, row.hash) if row else None
def cache_file(self, md5_digest, file_size, instance):
if not isinstance(instance, (InputDocument, InputPhoto)):

View File

@ -5,9 +5,10 @@ from base64 import b64decode
from os.path import isfile as file_exists
from .memory import MemorySession, _SentFileType
from .. import utils
from ..crypto import AuthKey
from ..tl.types import (
InputPhoto, InputDocument
InputPhoto, InputDocument, PeerUser, PeerChat, PeerChannel
)
EXTENSION = '.session'
@ -270,9 +271,19 @@ class SQLiteSession(MemorySession):
return self._fetchone_entity(
'select id, hash from entities where name=?', (name,))
def get_entity_rows_by_id(self, id):
return self._fetchone_entity(
'select id, hash from entities where id=?', (id,))
def get_entity_rows_by_id(self, id, exact=True):
if exact:
return self._fetchone_entity(
'select id, hash from entities where id=?', (id,))
else:
ids = (
utils.get_peer_id(PeerUser(id)),
utils.get_peer_id(PeerChat(id)),
utils.get_peer_id(PeerChannel(id))
)
return self._fetchone_entity(
'select id, hash from entities where id in (?,?,?)', ids
)
# File processing

View File

@ -425,11 +425,11 @@ class TelegramBareClient:
if result is not None:
return result
__log__.warning('Invoking %s failed %d times, '
'reconnecting and retrying',
[str(x) for x in requests], retry + 1)
log = __log__.info if retry == 0 else __log__.warning
log('Invoking %s failed %d times, connecting again and retrying',
[str(x) for x in requests], retry + 1)
await asyncio.sleep(retry + 1, loop=self._loop)
await asyncio.sleep(1)
if not self._reconnect_lock.locked():
with await self._reconnect_lock:
await self._reconnect()

View File

@ -8,7 +8,7 @@ import os
import re
import sys
import warnings
from collections import OrderedDict, UserList
from collections import UserList
from datetime import datetime, timedelta
from io import BytesIO
from mimetypes import guess_type
@ -82,7 +82,8 @@ from .tl.types import (
InputDocument, InputMediaDocument, Document, MessageEntityTextUrl,
InputMessageEntityMentionName, DocumentAttributeVideo,
UpdateEditMessage, UpdateEditChannelMessage, UpdateShort, Updates,
MessageMediaWebPage, ChannelParticipantsSearch
MessageMediaWebPage, ChannelParticipantsSearch, PhotoSize, PhotoCachedSize,
PhotoSizeEmpty, MessageService
)
from .tl.types.messages import DialogsSlice
from .extensions import markdown, html
@ -90,6 +91,12 @@ from .extensions import markdown, html
__log__ = logging.getLogger(__name__)
class _Box:
"""Helper class to pass parameters by reference"""
def __init__(self, x=None):
self.x = x
class TelegramClient(TelegramBareClient):
"""
Initializes the Telegram client with the specified API ID and Hash.
@ -506,10 +513,11 @@ class TelegramClient(TelegramBareClient):
# region Dialogs ("chats") requests
async def get_dialogs(self, limit=10, offset_date=None, offset_id=0,
offset_peer=InputPeerEmpty()):
async def iter_dialogs(self, limit=None, offset_date=None, offset_id=0,
offset_peer=InputPeerEmpty(), _total_box=None):
"""
Gets N "dialogs" (open "chats" or conversations with other people).
Returns an iterator over the dialogs, yielding 'limit' at most.
Dialogs are the open "chats" or conversations with other people.
Args:
limit (:obj:`int` | :obj:`None`):
@ -528,11 +536,16 @@ class TelegramClient(TelegramBareClient):
offset_peer (:obj:`InputPeer`, optional):
The peer to be used as an offset.
Returns:
A list dialogs, with an additional .total attribute on the list.
_total_box (:obj:`_Box`, optional):
A _Box instance to pass the total parameter by reference.
Yields:
Instances of ``telethon.tl.custom.Dialog``.
"""
limit = float('inf') if limit is None else int(limit)
if limit == 0:
if not _total_box:
return
# Special case, get a single dialog and determine count
dialogs = await self(GetDialogsRequest(
offset_date=offset_date,
@ -540,59 +553,76 @@ class TelegramClient(TelegramBareClient):
offset_peer=offset_peer,
limit=1
))
result = UserList()
result.total = getattr(dialogs, 'count', len(dialogs.dialogs))
return result
_total_box.x = getattr(dialogs, 'count', len(dialogs.dialogs))
return
total_count = 0
dialogs = OrderedDict() # Use peer id as identifier to avoid dupes
while len(dialogs) < limit:
real_limit = min(limit - len(dialogs), 100)
r = await self(GetDialogsRequest(
offset_date=offset_date,
offset_id=offset_id,
offset_peer=offset_peer,
limit=real_limit
))
seen = set()
req = GetDialogsRequest(
offset_date=offset_date,
offset_id=offset_id,
offset_peer=offset_peer,
limit=0
)
while len(seen) < limit:
req.limit = min(limit - len(seen), 100)
r = await self(req)
total_count = getattr(r, 'count', len(r.dialogs))
if _total_box:
_total_box.x = getattr(r, 'count', len(r.dialogs))
messages = {m.id: m for m in r.messages}
entities = {utils.get_peer_id(x): x
for x in itertools.chain(r.users, r.chats)}
for d in r.dialogs:
dialogs[utils.get_peer_id(d.peer)] = \
Dialog(self, d, entities, messages)
# Happens when there are pinned dialogs
if len(r.dialogs) > 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 "{}". '

View File

@ -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

View File

@ -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)))