From 6977641b2d5123b7dc7dc44e31bcb9b60bb6994e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 29 Jul 2022 02:21:05 +0200 Subject: [PATCH] Upgrade to layer 144: Premium gifts, custom emoji stickers... --- .github/dev.yml | 2 +- .github/release.yml | 2 +- README.md | 2 +- src/TL.Schema.cs | 122 ++++++++++++++++++++++++++++++++++++++++-- src/TL.SchemaFuncs.cs | 105 ++++++++++++++++++++++++------------ src/TL.Table.cs | 20 +++++-- 6 files changed, 206 insertions(+), 47 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 2b26cff..fce32d5 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 2.5.3-dev.$(Rev:r) +name: 2.6.1-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/.github/release.yml b/.github/release.yml index 08ed80b..b6de330 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,7 +1,7 @@ pr: none trigger: none -name: 2.5.$(Rev:r) +name: 2.6.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/README.md b/README.md index 8ddcfd2..591d69a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![NuGet version](https://img.shields.io/nuget/v/WTelegramClient)](https://www.nuget.org/packages/WTelegramClient/) [![Build Status](https://img.shields.io/azure-devops/build/wiz0u/WTelegramClient/7)](https://dev.azure.com/wiz0u/WTelegramClient/_build?definitionId=7) -[![API Layer](https://img.shields.io/badge/API_Layer-143-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-144-blueviolet)](https://corefork.telegram.org/methods) [![dev nuget](https://img.shields.io/badge/dynamic/json?color=ffc040&label=dev%20nuget&query=%24.versions%5B0%5D&url=https%3A%2F%2Fpkgs.dev.azure.com%2Fwiz0u%2F81bd92b7-0bb9-4701-b426-09090b27e037%2F_packaging%2F46ce0497-7803-4bd4-8c6c-030583e7c371%2Fnuget%2Fv3%2Fflat2%2Fwtelegramclient%2Findex.json)](https://dev.azure.com/wiz0u/WTelegramClient/_artifacts/feed/WTelegramClient/NuGet/WTelegramClient) [![Support Chat](https://img.shields.io/badge/Chat_with_us-on_Telegram-0088cc)](https://t.me/WTelegramClient) [![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](http://wizou.fr/donate.html) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index cb70955..b2d52b9 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -2104,6 +2104,14 @@ namespace TL { public string text; } + /// See + [TLDef(0xABA0F5C6)] + public class MessageActionGiftPremium : MessageAction + { + public string currency; + public long amount; + public int months; + } /// Chat info. Derived classes: , See public abstract class DialogBase : IObject @@ -2635,7 +2643,7 @@ namespace TL } /// Extended user info See - [TLDef(0x8C72EA81)] + [TLDef(0xC4B1FC3F)] public class UserFull : IObject { /// Flags, see TL conditional fields @@ -2666,6 +2674,7 @@ namespace TL [IfFlag(16)] public string private_forward_name; [IfFlag(17)] public ChatAdminRights bot_group_admin_rights; [IfFlag(18)] public ChatAdminRights bot_broadcast_admin_rights; + [IfFlag(19)] public PremiumGiftOption[] premium_gifts; [Flags] public enum Flags : uint { @@ -2701,6 +2710,9 @@ namespace TL has_bot_group_admin_rights = 0x20000, /// Field has a value has_bot_broadcast_admin_rights = 0x40000, + /// Field has a value + has_premium_gifts = 0x80000, + voice_messages_forbidden = 0x100000, } } @@ -3393,6 +3405,7 @@ namespace TL { /// Whether the updated stickers are mask stickers masks = 0x1, + emojis = 0x2, } } /// Installed stickersets have changed, the client should refetch them using messages.getAllStickers See @@ -4192,6 +4205,9 @@ namespace TL pending = 0x1, } } + /// See + [TLDef(0xFB4C496C)] + public class UpdateReadFeaturedEmojiStickers : Update { } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -5294,6 +5310,8 @@ namespace TL PhoneNumber = 0x0352DAFA, ///Whether people can add you to their contact list by your phone number AddedByPhone = 0xD1219BDD, + ///See + VoiceMessages = 0xAEE69D68, } /// Privacy key See @@ -5315,6 +5333,8 @@ namespace TL PhoneNumber = 0xD19AE46D, ///Whether people can add you to their contact list by your phone number AddedByPhone = 0x42FFD42B, + ///See + VoiceMessages = 0x0697F414, } /// Privacy rule Derived classes: , , , , , , , See @@ -5518,6 +5538,19 @@ namespace TL /// Whether the current document has stickers attached See [TLDef(0x9801D2F7)] public class DocumentAttributeHasStickers : DocumentAttribute { } + /// See + [TLDef(0xFD149899)] + public class DocumentAttributeCustomEmoji : DocumentAttribute + { + public Flags flags; + public string alt; + public InputStickerSet stickerset; + + [Flags] public enum Flags : uint + { + free = 0x1, + } + } /// Found stickers See /// a null value means messages.stickersNotModified @@ -5984,9 +6017,12 @@ namespace TL /// Animated emoji reaction stickerset (contains animations to play when a user clicks on a given animated emoji) See [TLDef(0x0CDE3739)] public class InputStickerSetAnimatedEmojiAnimations : InputStickerSet { } + /// See + [TLDef(0xC88B3B02)] + public class InputStickerSetPremiumGifts : InputStickerSet { } /// Represents a stickerset (stickerpack) See - [TLDef(0xD7DF217A)] + [TLDef(0x2DD14EDC)] public partial class StickerSet : IObject { /// Flags, see TL conditional fields @@ -6007,6 +6043,7 @@ namespace TL [IfFlag(4)] public int thumb_dc_id; /// Thumbnail version [IfFlag(4)] public int thumb_version; + [IfFlag(8)] public long thumb_document_id; /// Number of stickers in pack public int count; /// Hash @@ -6028,6 +6065,9 @@ namespace TL animated = 0x20, /// Is this a video stickerpack videos = 0x40, + emojis = 0x80, + /// Field has a value + has_thumb_document_id = 0x100, } } @@ -6422,6 +6462,12 @@ namespace TL /// Message entity representing a spoiler See [TLDef(0x32CA960F)] public class MessageEntitySpoiler : MessageEntity { } + /// See + [TLDef(0xC8CF05F8, inheritBefore = true)] + public class MessageEntityCustomEmoji : MessageEntity + { + public long document_id; + } /// Represents a channel Derived classes: , See /// a null value means inputChannelEmpty @@ -7729,9 +7775,10 @@ namespace TL public int count; } /// Featured stickersets See - [TLDef(0x84C02310)] + [TLDef(0xBE382906)] public class Messages_FeaturedStickers : Messages_FeaturedStickersBase { + public Flags flags; /// Hash for pagination, for more info click here public long hash; /// Total number of featured stickers @@ -7740,6 +7787,11 @@ namespace TL public StickerSetCoveredBase[] sets; /// IDs of new featured stickersets public long[] unread; + + [Flags] public enum Flags : uint + { + premium = 0x1, + } } /// Recently used stickers See @@ -7810,6 +7862,16 @@ namespace TL /// Stickerset public override StickerSet Set => set; } + /// See + [TLDef(0x1AED5EE5)] + public class StickerSetFullCovered : StickerSetCoveredBase + { + public StickerSet set; + public StickerPack[] packs; + public DocumentBase[] documents; + + public override StickerSet Set => set; + } /// Position on a photo where a mask should be placed See [TLDef(0xAED6DBB2)] @@ -8614,7 +8676,7 @@ namespace TL } /// Payment form See - [TLDef(0xB0133B37)] + [TLDef(0xA0058751)] public class Payments_PaymentForm : IObject { /// Flags, see TL conditional fields @@ -8636,10 +8698,11 @@ namespace TL [IfFlag(4)] public string native_provider; /// Contains information about the payment provider, if available, to support it natively without the need for opening the URL.
A JSON object that can contain the following fields:

- apple_pay_merchant_id: Apple Pay merchant ID
- google_pay_public_key: Google Pay public key
- need_country: True, if the user country must be provided,
- need_zip: True, if the user ZIP/postal code must be provided,
- need_cardholder_name: True, if the cardholder name must be provided
[IfFlag(4)] public DataJSON native_params; + [IfFlag(6)] public PaymentFormMethod[] additional_methods; /// Saved server-side order information [IfFlag(0)] public PaymentRequestedInfo saved_info; /// Contains information about saved card credentials - [IfFlag(1)] public PaymentSavedCredentials saved_credentials; + [IfFlag(1)] public PaymentSavedCredentials[] saved_credentials; /// Users public Dictionary users; @@ -8657,6 +8720,8 @@ namespace TL has_native_provider = 0x10, /// Field has a value has_photo = 0x20, + /// Field has a value + has_additional_methods = 0x40, } } @@ -13097,4 +13162,51 @@ namespace TL public long monthly_amount; public Dictionary users; } + + /// See + public abstract class InputStorePaymentPurpose : IObject { } + /// See + [TLDef(0xA6751E66)] + public class InputStorePaymentPremiumSubscription : InputStorePaymentPurpose + { + public Flags flags; + + [Flags] public enum Flags : uint + { + restore = 0x1, + } + } + /// See + [TLDef(0x616F7FE8)] + public class InputStorePaymentGiftPremium : InputStorePaymentPurpose + { + public InputUserBase user_id; + public string currency; + public long amount; + } + + /// See + [TLDef(0x74C34319)] + public class PremiumGiftOption : IObject + { + public Flags flags; + public int months; + public string currency; + public long amount; + public string bot_url; + [IfFlag(0)] public string store_product; + + [Flags] public enum Flags : uint + { + has_store_product = 0x1, + } + } + + /// See + [TLDef(0x88F8F21B)] + public class PaymentFormMethod : IObject + { + public string url; + public string title; + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 7e6b6a8..9a6dfee 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -415,10 +415,12 @@ namespace TL /// Delete the user's account from the telegram servers. Can be used, for example, to delete the account of a user that provided the login code, but forgot the 2FA password and no recovery method is configured. See Possible codes: 420 (details) /// Why is the account being deleted, can be empty - public static Task Account_DeleteAccount(this Client client, string reason) + public static Task Account_DeleteAccount(this Client client, string reason, InputCheckPasswordSRP password = null) => client.Invoke(new Account_DeleteAccount { + flags = (Account_DeleteAccount.Flags)(password != null ? 0x1 : 0), reason = reason, + password = password, }); /// Get days to live of account See @@ -1844,10 +1846,10 @@ namespace TL /// Reorder installed stickersets See /// Reorder mask stickersets /// New stickerset order by stickerset IDs - public static Task Messages_ReorderStickerSets(this Client client, long[] order, bool masks = false) + public static Task Messages_ReorderStickerSets(this Client client, long[] order, bool masks = false, bool emojis = false) => client.Invoke(new Messages_ReorderStickerSets { - flags = (Messages_ReorderStickerSets.Flags)(masks ? 0x1 : 0), + flags = (Messages_ReorderStickerSets.Flags)((masks ? 0x1 : 0) | (emojis ? 0x2 : 0)), order = order, }); @@ -2106,10 +2108,10 @@ namespace TL /// Get mask stickers /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination - public static Task Messages_GetArchivedStickers(this Client client, long offset_id = default, int limit = int.MaxValue, bool masks = false) + public static Task Messages_GetArchivedStickers(this Client client, long offset_id = default, int limit = int.MaxValue, bool masks = false, bool emojis = false) => client.Invoke(new Messages_GetArchivedStickers { - flags = (Messages_GetArchivedStickers.Flags)(masks ? 0x1 : 0), + flags = (Messages_GetArchivedStickers.Flags)((masks ? 0x1 : 0) | (emojis ? 0x2 : 0)), offset_id = offset_id, limit = limit, }); @@ -3221,6 +3223,28 @@ namespace TL good = good, }); + /// See + public static Task Messages_GetCustomEmojiDocuments(this Client client, long[] document_id) + => client.Invoke(new Messages_GetCustomEmojiDocuments + { + document_id = document_id, + }); + + /// See + /// a null value means messages.allStickersNotModified + public static Task Messages_GetEmojiStickers(this Client client, long hash = default) + => client.Invoke(new Messages_GetEmojiStickers + { + hash = hash, + }); + + /// See + public static Task Messages_GetFeaturedEmojiStickers(this Client client, long hash = default) + => client.Invoke(new Messages_GetFeaturedEmojiStickers + { + hash = hash, + }); + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState @@ -4158,32 +4182,26 @@ namespace TL }); /// See - public static Task Payments_AssignAppStoreTransaction(this Client client, string transaction_id, byte[] receipt, bool restore = false) + public static Task Payments_AssignAppStoreTransaction(this Client client, byte[] receipt, InputStorePaymentPurpose purpose) => client.Invoke(new Payments_AssignAppStoreTransaction { - flags = (Payments_AssignAppStoreTransaction.Flags)(restore ? 0x1 : 0), - transaction_id = transaction_id, receipt = receipt, + purpose = purpose, }); /// See - public static Task Payments_AssignPlayMarketTransaction(this Client client, string purchase_token) + public static Task Payments_AssignPlayMarketTransaction(this Client client, DataJSON receipt, InputStorePaymentPurpose purpose) => client.Invoke(new Payments_AssignPlayMarketTransaction - { - purchase_token = purchase_token, - }); - - /// See - public static Task Payments_RestorePlayMarketReceipt(this Client client, byte[] receipt) - => client.Invoke(new Payments_RestorePlayMarketReceipt { receipt = receipt, + purpose = purpose, }); /// See - public static Task Payments_CanPurchasePremium(this Client client) + public static Task Payments_CanPurchasePremium(this Client client, InputStorePaymentPurpose purpose) => client.Invoke(new Payments_CanPurchasePremium { + purpose = purpose, }); /// See @@ -5057,10 +5075,17 @@ namespace TL.Methods public InputPrivacyRule[] rules; } - [TLDef(0x418D4E0B)] + [TLDef(0xA2C0CF74)] public class Account_DeleteAccount : IMethod { + public Flags flags; public string reason; + [IfFlag(0)] public InputCheckPasswordSRP password; + + [Flags] public enum Flags : uint + { + has_password = 0x1, + } } [TLDef(0x08FC711D)] @@ -6205,6 +6230,7 @@ namespace TL.Methods [Flags] public enum Flags : uint { masks = 0x1, + emojis = 0x2, } } @@ -6456,6 +6482,7 @@ namespace TL.Methods [Flags] public enum Flags : uint { masks = 0x1, + emojis = 0x2, } } @@ -7387,6 +7414,24 @@ namespace TL.Methods public bool good; } + [TLDef(0xD9AB0F54)] + public class Messages_GetCustomEmojiDocuments : IMethod + { + public long[] document_id; + } + + [TLDef(0xFBFCA18F)] + public class Messages_GetEmojiStickers : IMethod + { + public long hash; + } + + [TLDef(0x0ECF6736)] + public class Messages_GetFeaturedEmojiStickers : IMethod + { + public long hash; + } + [TLDef(0xEDD4882A)] public class Updates_GetState : IMethod { } @@ -8099,34 +8144,26 @@ namespace TL.Methods public InputMedia invoice_media; } - [TLDef(0x0FEC13C6)] + [TLDef(0x80ED747D)] public class Payments_AssignAppStoreTransaction : IMethod { - public Flags flags; - public string transaction_id; public byte[] receipt; - - [Flags] public enum Flags : uint - { - restore = 0x1, - } + public InputStorePaymentPurpose purpose; } - [TLDef(0x4FAA4AED)] + [TLDef(0xDFFD50D3)] public class Payments_AssignPlayMarketTransaction : IMethod { - public string purchase_token; + public DataJSON receipt; + public InputStorePaymentPurpose purpose; } - [TLDef(0xD164E36A)] - public class Payments_RestorePlayMarketReceipt : IMethod + [TLDef(0x9FC19EB6)] + public class Payments_CanPurchasePremium : IMethod { - public byte[] receipt; + public InputStorePaymentPurpose purpose; } - [TLDef(0xAA6A90C8)] - public class Payments_CanPurchasePremium : IMethod { } - [TLDef(0x146E958D)] public class Payments_RequestRecurringPayment : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 6cadf0d..dd1244e 100644 --- a/src/TL.Table.cs +++ b/src/TL.Table.cs @@ -6,7 +6,7 @@ namespace TL { public static class Layer { - public const int Version = 143; // fetched 14/06/2022 23:30:05 + public const int Version = 144; // fetched 28/07/2022 23:41:51 internal const uint VectorCtor = 0x1CB5C415; internal const uint NullCtor = 0x56730BCC; internal const uint RpcResultCtor = 0xF35C6D01; @@ -187,6 +187,7 @@ namespace TL [0xEBBCA3CB] = typeof(MessageActionChatJoinedByRequest), [0x47DD8079] = typeof(MessageActionWebViewDataSentMe), [0xB4C38CB5] = typeof(MessageActionWebViewDataSent), + [0xABA0F5C6] = typeof(MessageActionGiftPremium), [0xA8EDD0F5] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), [0x2331B22D] = typeof(PhotoEmpty), @@ -212,7 +213,7 @@ namespace TL [0xA518110D] = typeof(PeerSettings), [0xA437C3ED] = typeof(WallPaper), [0xE0804116] = typeof(WallPaperNoFile), - [0x8C72EA81] = typeof(UserFull), + [0xC4B1FC3F] = typeof(UserFull), [0x145ADE0B] = typeof(Contact), [0xC13E3C50] = typeof(ImportedContact), [0x16D9703B] = typeof(ContactStatus), @@ -350,6 +351,7 @@ namespace TL [0x14B85813] = typeof(UpdateBotMenuButton), [0x74D8BE99] = typeof(UpdateSavedRingtones), [0x0084CD5A] = typeof(UpdateTranscribedAudio), + [0xFB4C496C] = typeof(UpdateReadFeaturedEmojiStickers), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -444,6 +446,7 @@ namespace TL [0x9852F9C6] = typeof(DocumentAttributeAudio), [0x15590068] = typeof(DocumentAttributeFilename), [0x9801D2F7] = typeof(DocumentAttributeHasStickers), + [0xFD149899] = typeof(DocumentAttributeCustomEmoji), [0xF1749A22] = null,//Messages_StickersNotModified [0x30A6EC7E] = typeof(Messages_Stickers), [0x12B299D4] = typeof(StickerPack), @@ -472,7 +475,8 @@ namespace TL [0x028703C8] = typeof(InputStickerSetAnimatedEmoji), [0xE67F520E] = typeof(InputStickerSetDice), [0x0CDE3739] = typeof(InputStickerSetAnimatedEmojiAnimations), - [0xD7DF217A] = typeof(StickerSet), + [0xC88B3B02] = typeof(InputStickerSetPremiumGifts), + [0x2DD14EDC] = typeof(StickerSet), [0xB60A24A6] = typeof(Messages_StickerSet), [0xD3F924EB] = null,//Messages_StickerSetNotModified [0xC27AC8C7] = typeof(BotCommand), @@ -517,6 +521,7 @@ namespace TL [0x020DF5D0] = typeof(MessageEntityBlockquote), [0x761E6AF4] = typeof(MessageEntityBankCard), [0x32CA960F] = typeof(MessageEntitySpoiler), + [0xC8CF05F8] = typeof(MessageEntityCustomEmoji), [0xEE8C1E86] = null,//InputChannelEmpty [0xF35AEC28] = typeof(InputChannel), [0x5B934F9D] = typeof(InputChannelFromMessage), @@ -588,7 +593,7 @@ namespace TL [0x1B0C841A] = typeof(DraftMessageEmpty), [0xFD8E711F] = typeof(DraftMessage), [0xC6DC0C66] = typeof(Messages_FeaturedStickersNotModified), - [0x84C02310] = typeof(Messages_FeaturedStickers), + [0xBE382906] = typeof(Messages_FeaturedStickers), [0x0B17F890] = null,//Messages_RecentStickersNotModified [0x88D37C56] = typeof(Messages_RecentStickers), [0x4FCBA9C8] = typeof(Messages_ArchivedStickers), @@ -596,6 +601,7 @@ namespace TL [0x35E410A8] = typeof(Messages_StickerSetInstallResultArchive), [0x6410A5D2] = typeof(StickerSetCovered), [0x3407E51B] = typeof(StickerSetMultiCovered), + [0x1AED5EE5] = typeof(StickerSetFullCovered), [0xAED6DBB2] = typeof(MaskCoords), [0x4A992157] = typeof(InputStickeredMediaPhoto), [0x0438865B] = typeof(InputStickeredMediaDocument), @@ -662,7 +668,7 @@ namespace TL [0xC239D686] = typeof(InputWebFileLocation), [0x9F2221C9] = typeof(InputWebFileGeoPointLocation), [0x21E753BC] = typeof(Upload_WebFile), - [0xB0133B37] = typeof(Payments_PaymentForm), + [0xA0058751] = typeof(Payments_PaymentForm), [0xD1451883] = typeof(Payments_ValidatedRequestedInfo), [0x4E5F810D] = typeof(Payments_PaymentResult), [0xD8411139] = typeof(Payments_PaymentVerificationNeeded), @@ -980,6 +986,10 @@ namespace TL [0xAED0CBD9] = typeof(Payments_ExportedInvoice), [0x93752C52] = typeof(Messages_TranscribedAudio), [0x8A4F3C29] = typeof(Help_PremiumPromo), + [0xA6751E66] = typeof(InputStorePaymentPremiumSubscription), + [0x616F7FE8] = typeof(InputStorePaymentGiftPremium), + [0x74C34319] = typeof(PremiumGiftOption), + [0x88F8F21B] = typeof(PaymentFormMethod), // from TL.Secret: [0xBB718624] = typeof(Layer66.SendMessageUploadRoundAction), [0xE50511D8] = typeof(Layer45.DecryptedMessageMediaWebPage),