diff --git a/README.md b/README.md index 47419e1..32a183d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-200-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-201-blueviolet)](https://corefork.telegram.org/methods) [![NuGet version](https://img.shields.io/nuget/v/WTelegramClient?color=00508F)](https://www.nuget.org/packages/WTelegramClient/) [![NuGet prerelease](https://img.shields.io/nuget/vpre/WTelegramClient?color=C09030&label=dev+nuget)](https://www.nuget.org/packages/WTelegramClient/absoluteLatest) [![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](https://buymeacoffee.com/wizou) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 5caaf90..9a1af73 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -2946,6 +2946,19 @@ namespace TL has_peer = 0x80, } } + /// See + [TLDef(0xAC1F1FCD)] + public sealed partial class MessageActionPaidMessagesRefunded : MessageAction + { + public int count; + public long stars; + } + /// See + [TLDef(0xBCD71419)] + public sealed partial class MessageActionPaidMessagesPrice : MessageAction + { + public long stars; + } /// Chat info. See Derived classes: , public abstract partial class DialogBase : IObject @@ -3225,6 +3238,13 @@ namespace TL /// Authorization info public Auth_AuthorizationBase authorization; } + /// See + [TLDef(0xD7CEF980)] + public sealed partial class Auth_SentCodePaymentRequired : Auth_SentCodeBase + { + public string store_product; + public string phone_code_hash; + } /// Object contains info on user authorization. See Derived classes: , public abstract partial class Auth_AuthorizationBase : IObject { } @@ -3565,7 +3585,7 @@ namespace TL } /// Extended user info See - [TLDef(0xD2234EA0)] + [TLDef(0x99E78045)] public sealed partial class UserFull : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -3630,6 +3650,7 @@ namespace TL [IfFlag(43)] public StarRefProgram starref_program; [IfFlag(44)] public BotVerification bot_verification; [IfFlag(46)] public long send_paid_messages_stars; + [IfFlag(47)] public DisallowedGiftsSettings disallowed_gifts; [Flags] public enum Flags : uint { @@ -3719,6 +3740,9 @@ namespace TL has_bot_verification = 0x1000, /// Field has a value has_send_paid_messages_stars = 0x4000, + /// Field has a value + has_disallowed_gifts = 0x8000, + display_gifts_button = 0x10000, } } @@ -5788,6 +5812,12 @@ namespace TL /// Whether paid reaction privacy is enabled or disabled. public PaidReactionPrivacy private_; } + /// See + [TLDef(0x504AA18F)] + public sealed partial class UpdateSentPhoneCode : Update + { + public Auth_SentCodeBase sent_code; + } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -14484,12 +14514,13 @@ namespace TL } /// Global privacy settings See - [TLDef(0xC9D8DF1C)] + [TLDef(0xFE41B34F)] public sealed partial class GlobalPrivacySettings : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(5)] public long noncontact_peers_paid_stars; + [IfFlag(6)] public DisallowedGiftsSettings disallowed_gifts; [Flags] public enum Flags : uint { @@ -14505,6 +14536,9 @@ namespace TL new_noncontact_peers_require_premium = 0x10, /// Field has a value has_noncontact_peers_paid_stars = 0x20, + /// Field has a value + has_disallowed_gifts = 0x40, + display_gifts_button = 0x80, } } @@ -16118,6 +16152,21 @@ namespace TL has_prize_description = 0x10, } } + /// See + [TLDef(0x9BB2636D)] + public sealed partial class InputStorePaymentAuthCode : InputStorePaymentPurpose + { + public Flags flags; + public string phone_number; + public string phone_code_hash; + public string currency; + public long amount; + + [Flags] public enum Flags : uint + { + restore = 0x1, + } + } /// Represents an additional payment method See [TLDef(0x88F8F21B)] @@ -18644,7 +18693,7 @@ namespace TL } /// Contains info about a connected business bot ». See - [TLDef(0xBD068601)] + [TLDef(0xCD64636C)] public sealed partial class ConnectedBot : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -18653,11 +18702,10 @@ namespace TL public long bot_id; /// Specifies the private chats that a connected business bot » may receive messages and interact with.
public BusinessBotRecipients recipients; + public BusinessBotRights rights; [Flags] public enum Flags : uint { - /// Whether the the bot can reply to messages it receives through the connection - can_reply = 0x1, } } @@ -18708,7 +18756,7 @@ namespace TL } /// Contains info about a bot business connection. See - [TLDef(0x896433B4)] + [TLDef(0x8F34B2F5)] public sealed partial class BotBusinessConnection : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -18721,13 +18769,14 @@ namespace TL public int dc_id; /// When was the connection created. public DateTime date; + [IfFlag(2)] public BusinessBotRights rights; [Flags] public enum Flags : uint { - /// Whether the bot can reply on behalf of the user to messages it receives through the business connection - can_reply = 0x1, /// Whether this business connection is currently disabled disabled = 0x2, + /// Field has a value + has_rights = 0x4, } } @@ -20365,4 +20414,73 @@ namespace TL { public long stars_amount; } + + /// See + [TLDef(0xA0624CF7)] + public sealed partial class BusinessBotRights : IObject + { + public Flags flags; + + [Flags] public enum Flags : uint + { + reply = 0x1, + read_messages = 0x2, + delete_sent_messages = 0x4, + delete_received_messages = 0x8, + edit_name = 0x10, + edit_bio = 0x20, + edit_profile_photo = 0x40, + edit_username = 0x80, + view_gifts = 0x100, + sell_gifts = 0x200, + change_gift_settings = 0x400, + transfer_and_upgrade_gifts = 0x800, + transfer_stars = 0x1000, + manage_stories = 0x2000, + } + } + + /// See + [TLDef(0x71F276C4)] + public sealed partial class DisallowedGiftsSettings : IObject + { + public Flags flags; + + [Flags] public enum Flags : uint + { + disallow_unlimited_stargifts = 0x1, + disallow_limited_stargifts = 0x2, + disallow_unique_stargifts = 0x4, + disallow_premium_gifts = 0x8, + } + } + + /// See + [TLDef(0xC69708D3)] + public sealed partial class SponsoredPeer : IObject + { + public Flags flags; + public byte[] random_id; + public Peer peer; + [IfFlag(0)] public string sponsor_info; + [IfFlag(1)] public string additional_info; + + [Flags] public enum Flags : uint + { + has_sponsor_info = 0x1, + has_additional_info = 0x2, + } + } + + /// See + /// a value means contacts.sponsoredPeersEmpty + [TLDef(0xEB032884)] + public sealed partial class Contacts_SponsoredPeers : IObject, IPeerResolver + { + public SponsoredPeer[] peers; + public Dictionary chats; + public Dictionary users; + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 004175d..aa0b3db 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1293,14 +1293,14 @@ namespace TL }); /// Connect a business bot » to the current account, or to change the current connection settings. See Possible codes: 400,403 (details) - /// Whether the bot can reply to messages it receives from us, on behalf of us using the business connection. /// Whether to fully disconnect the bot from the current account. /// The bot to connect or disconnect /// Configuration for the business connection - public static Task Account_UpdateConnectedBot(this Client client, InputUserBase bot, InputBusinessBotRecipients recipients, bool can_reply = false, bool deleted = false) + public static Task Account_UpdateConnectedBot(this Client client, InputUserBase bot, InputBusinessBotRecipients recipients, BusinessBotRights rights = null, bool deleted = false) => client.Invoke(new Account_UpdateConnectedBot { - flags = (Account_UpdateConnectedBot.Flags)((can_reply ? 0x1 : 0) | (deleted ? 0x2 : 0)), + flags = (Account_UpdateConnectedBot.Flags)((rights != null ? 0x1 : 0) | (deleted ? 0x2 : 0)), + rights = rights, bot = bot, recipients = recipients, }); @@ -1730,6 +1730,14 @@ namespace TL { }); + /// See + /// a null value means contacts.sponsoredPeersEmpty + public static Task Contacts_GetSponsoredPeers(this Client client, string q) + => client.Invoke(new Contacts_GetSponsoredPeers + { + q = q, + }); + /// This method is only for basic Chat. See Terminology in the README to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Returns the list of messages by their IDs. See [bots: ✓]
/// Message ID list public static Task Messages_GetMessages(this Client client, params InputMessage[] id) @@ -2424,7 +2432,7 @@ namespace TL unsave = unsave, }); - /// Query an inline bot See Possible codes: 400,406,-503 (details) + /// Query an inline bot See Possible codes: -503,400,406 (details) /// The bot to query /// The currently opened chat /// The geolocation, if requested @@ -2544,7 +2552,7 @@ namespace TL entities = entities, }); - /// Press an inline callback button and get a callback answer from the bot See Possible codes: 400,-503 (details) + /// Press an inline callback button and get a callback answer from the bot See Possible codes: -503,400 (details) /// Whether this is a "play game" button /// Where was the inline keyboard sent /// ID of the Message with the inline keyboard @@ -4399,36 +4407,30 @@ namespace TL }); /// Mark a specific sponsored message » as read See - /// The channel/bot where the ad is located /// The ad's unique ID. - public static Task Messages_ViewSponsoredMessage(this Client client, InputPeer peer, byte[] random_id) + public static Task Messages_ViewSponsoredMessage(this Client client, byte[] random_id) => client.Invoke(new Messages_ViewSponsoredMessage { - peer = peer, random_id = random_id, }); /// Informs the server that the user has interacted with a sponsored message in one of the ways listed here ». See /// The user clicked on the media /// The user expanded the video to full screen, and then clicked on it. - /// The channel/bot where the ad is located /// The ad's unique ID. - public static Task Messages_ClickSponsoredMessage(this Client client, InputPeer peer, byte[] random_id, bool media = false, bool fullscreen = false) + public static Task Messages_ClickSponsoredMessage(this Client client, byte[] random_id, bool media = false, bool fullscreen = false) => client.Invoke(new Messages_ClickSponsoredMessage { flags = (Messages_ClickSponsoredMessage.Flags)((media ? 0x1 : 0) | (fullscreen ? 0x2 : 0)), - peer = peer, random_id = random_id, }); /// Report a sponsored message », see here » for more info on the full flow. See - /// The channel/bot where the ad is located /// The ad's unique ID. /// Chosen report option, initially an empty string, see here » for more info on the full flow. - public static Task Messages_ReportSponsoredMessage(this Client client, InputPeer peer, byte[] random_id, byte[] option) + public static Task Messages_ReportSponsoredMessage(this Client client, byte[] random_id, byte[] option) => client.Invoke(new Messages_ReportSponsoredMessage { - peer = peer, random_id = random_id, option = option, }); @@ -5999,14 +6001,6 @@ namespace TL purpose = purpose, }); - /// Checks whether Telegram Premium purchase is possible. Must be called before in-store Premium purchase, official apps only. See Possible codes: 406 (details) - /// Payment purpose - public static Task Payments_CanPurchasePremium(this Client client, InputStorePaymentPurpose purpose) - => client.Invoke(new Payments_CanPurchasePremium - { - purpose = purpose, - }); - /// Obtain a list of Telegram Premium giveaway/gift code » options. See /// The channel that will start the giveaway public static Task Payments_GetPremiumGiftCodeOptions(this Client client, InputPeer boost_peer = null) @@ -6366,6 +6360,13 @@ namespace TL stargift = stargift, }); + /// See + public static Task Payments_CanPurchaseStore(this Client client, InputStorePaymentPurpose purpose) + => client.Invoke(new Payments_CanPurchaseStore + { + purpose = purpose, + }); + /// Create a stickerset. See [bots: ✓] Possible codes: 400 (details) /// Whether this is a mask stickerset /// Whether this is a custom emoji stickerset. @@ -8583,16 +8584,17 @@ namespace TL.Methods } } - [TLDef(0x43D8521D)] + [TLDef(0x66A08C7E)] public sealed partial class Account_UpdateConnectedBot : IMethod { public Flags flags; + [IfFlag(0)] public BusinessBotRights rights; public InputUserBase bot; public InputBusinessBotRecipients recipients; [Flags] public enum Flags : uint { - can_reply = 0x1, + has_rights = 0x1, deleted = 0x2, } } @@ -8958,6 +8960,12 @@ namespace TL.Methods [TLDef(0xDAEDA864)] public sealed partial class Contacts_GetBirthdays : IMethod { } + [TLDef(0xB6C8C393)] + public sealed partial class Contacts_GetSponsoredPeers : IMethod + { + public string q; + } + [TLDef(0x63C66506)] public sealed partial class Messages_GetMessages : IMethod { @@ -11238,18 +11246,16 @@ namespace TL.Methods [TLDef(0x472455AA)] public sealed partial class Messages_GetPaidReactionPrivacy : IMethod { } - [TLDef(0x673AD8F1)] + [TLDef(0x269E3643)] public sealed partial class Messages_ViewSponsoredMessage : IMethod { - public InputPeer peer; public byte[] random_id; } - [TLDef(0x0F093465)] + [TLDef(0x8235057E)] public sealed partial class Messages_ClickSponsoredMessage : IMethod { public Flags flags; - public InputPeer peer; public byte[] random_id; [Flags] public enum Flags : uint @@ -11259,10 +11265,9 @@ namespace TL.Methods } } - [TLDef(0x1AF3DBB8)] + [TLDef(0x12CBF0C4)] public sealed partial class Messages_ReportSponsoredMessage : IMethod { - public InputPeer peer; public byte[] random_id; public byte[] option; } @@ -12507,12 +12512,6 @@ namespace TL.Methods public InputStorePaymentPurpose purpose; } - [TLDef(0x9FC19EB6)] - public sealed partial class Payments_CanPurchasePremium : IMethod - { - public InputStorePaymentPurpose purpose; - } - [TLDef(0x2757BA54)] public sealed partial class Payments_GetPremiumGiftCodeOptions : IMethod { @@ -12851,6 +12850,12 @@ namespace TL.Methods public InputSavedStarGift[] stargift; } + [TLDef(0x4FDC5EA7)] + public sealed partial class Payments_CanPurchaseStore : IMethod + { + public InputStorePaymentPurpose purpose; + } + [TLDef(0x9021AB67)] public sealed partial class Stickers_CreateStickerSet : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 1b55bf1..e441650 100644 --- a/src/TL.Table.cs +++ b/src/TL.Table.cs @@ -6,7 +6,7 @@ namespace TL { public static partial class Layer { - public const int Version = 200; // fetched 07/03/2025 23:09:37 + public const int Version = 201; // fetched 26/03/2025 23:35:58 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -215,6 +215,8 @@ namespace TL [0xB00C47A2] = typeof(MessageActionPrizeStars), [0x4717E8A4] = typeof(MessageActionStarGift), [0xACDFCB81] = typeof(MessageActionStarGiftUnique), + [0xAC1F1FCD] = typeof(MessageActionPaidMessagesRefunded), + [0xBCD71419] = typeof(MessageActionPaidMessagesPrice), [0xD58A08C6] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), [0x2331B22D] = typeof(PhotoEmpty), @@ -229,6 +231,7 @@ namespace TL [0xB2A2F663] = typeof(GeoPoint), [0x5E002502] = typeof(Auth_SentCode), [0x2390FE44] = typeof(Auth_SentCodeSuccess), + [0xD7CEF980] = typeof(Auth_SentCodePaymentRequired), [0x2EA2C0D4] = typeof(Auth_Authorization), [0x44747E9A] = typeof(Auth_AuthorizationSignUpRequired), [0xB434E2B8] = typeof(Auth_ExportedAuthorization), @@ -242,7 +245,7 @@ namespace TL [0xF47741F7] = typeof(PeerSettings), [0xA437C3ED] = typeof(WallPaper), [0xE0804116] = typeof(WallPaperNoFile), - [0xD2234EA0] = typeof(UserFull), + [0x99E78045] = typeof(UserFull), [0x145ADE0B] = typeof(Contact), [0xC13E3C50] = typeof(ImportedContact), [0x16D9703B] = typeof(ContactStatus), @@ -420,6 +423,7 @@ namespace TL [0xA584B019] = typeof(UpdateStarsRevenueStatus), [0x283BD312] = typeof(UpdateBotPurchasedPaidMedia), [0x8B725FCE] = typeof(UpdatePaidReactionPrivacy), + [0x504AA18F] = typeof(UpdateSentPhoneCode), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -1013,7 +1017,7 @@ namespace TL [0xD7584C87] = typeof(StatsGroupTopAdmin), [0x535F779D] = typeof(StatsGroupTopInviter), [0xEF7FF916] = typeof(Stats_MegagroupStats), - [0xC9D8DF1C] = typeof(GlobalPrivacySettings), + [0xFE41B34F] = typeof(GlobalPrivacySettings), [0x4203C5EF] = typeof(Help_CountryCode), [0xC3878E23] = typeof(Help_Country), [0x93CC1F32] = null,//Help_CountriesListNotModified @@ -1117,6 +1121,7 @@ namespace TL [0xDDDD0F56] = typeof(InputStorePaymentStarsTopup), [0x1D741EF7] = typeof(InputStorePaymentStarsGift), [0x751F08FA] = typeof(InputStorePaymentStarsGiveaway), + [0x9BB2636D] = typeof(InputStorePaymentAuthCode), [0x88F8F21B] = typeof(PaymentFormMethod), [0x2DE11AAE] = null,//EmojiStatusEmpty [0xE7FF068A] = typeof(EmojiStatus), @@ -1275,11 +1280,11 @@ namespace TL [0x01190CF1] = typeof(InputQuickReplyShortcutId), [0xC68D6695] = typeof(Messages_QuickReplies), [0x5F91EB5B] = null,//Messages_QuickRepliesNotModified - [0xBD068601] = typeof(ConnectedBot), + [0xCD64636C] = typeof(ConnectedBot), [0x17D7F87B] = typeof(Account_ConnectedBots), [0x2AD93719] = typeof(Messages_DialogFilters), [0x6C8E1E06] = typeof(Birthday), - [0x896433B4] = typeof(BotBusinessConnection), + [0x8F34B2F5] = typeof(BotBusinessConnection), [0x09C469CD] = typeof(InputBusinessIntro), [0x5A0A066D] = typeof(BusinessIntro), [0xFAFF629D] = typeof(Messages_MyStickers), @@ -1384,6 +1389,11 @@ namespace TL [0x050A9839] = null,//RequirementToContactEmpty [0xE581E4E9] = typeof(RequirementToContactPremium), [0xB4F67E93] = typeof(RequirementToContactPaidMessages), + [0xA0624CF7] = typeof(BusinessBotRights), + [0x71F276C4] = typeof(DisallowedGiftsSettings), + [0xC69708D3] = typeof(SponsoredPeer), + [0xEA32B4B1] = null,//Contacts_SponsoredPeersEmpty + [0xEB032884] = typeof(Contacts_SponsoredPeers), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x020DF5D0] = typeof(Layer101.MessageEntityBlockquote), @@ -1516,6 +1526,7 @@ namespace TL [typeof(Payments_StarGifts)] = 0xA388A368, //payments.starGiftsNotModified [typeof(PaidReactionPrivacy)] = 0x206AD49E, //paidReactionPrivacyDefault [typeof(RequirementToContact)] = 0x050A9839, //requirementToContactEmpty + [typeof(Contacts_SponsoredPeers)] = 0xEA32B4B1, //contacts.sponsoredPeersEmpty [typeof(DecryptedMessageMedia)] = 0x089F5C4A, //decryptedMessageMediaEmpty }; } diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index dd5cdd1..1debd31 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -13,7 +13,7 @@ WTelegramClient 0.0.0 Wizou - Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 200 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 201 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A"))