diff --git a/.github/dev.yml b/.github/dev.yml index 15ebd73..1bb91a7 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 2.4.2-dev.$(Rev:r) +name: 2.5.1-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/.github/release.yml b/.github/release.yml index e1a09c2..08ed80b 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,7 +1,7 @@ pr: none trigger: none -name: 2.4.$(Rev:r) +name: 2.5.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/EXAMPLES.md b/EXAMPLES.md index 114ad3c..547dc5f 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -369,16 +369,19 @@ By default, WTelegramClient logs are displayed on the Console screen. If you are not in a Console app or don't want the logs on screen, you can redirect them as you prefer: ```csharp -// • Log to VS Output debugging pane in addition (+=) to default Console screen logging: -WTelegram.Helpers.Log += (lvl, str) => System.Diagnostics.Debug.WriteLine(str); - // • Log to file in replacement of default Console screen logging, using this static variable: static StreamWriter WTelegramLogs = new StreamWriter("WTelegram.log", true, Encoding.UTF8) { AutoFlush = true }; ... WTelegram.Helpers.Log = (lvl, str) => WTelegramLogs.WriteLine($"{DateTime.Now:yyyy-MM-dd HH:mm:ss} [{"TDIWE!"[lvl]}] {str}"); -// • In an ASP.NET service, you will typically send logs to an ILogger: +// • Log to VS Output debugging pane in addition (+=) to the default Console screen logging: +WTelegram.Helpers.Log += (lvl, str) => System.Diagnostics.Debug.WriteLine(str); + +// • In ASP.NET service, you will typically send logs to an ILogger: WTelegram.Helpers.Log = (lvl, str) => _logger.Log((LogLevel)lvl, str); + +// • Disable logging (THIS IS NOT RECOMMENDED as you won't be able to diagnose any upcoming problem): +WTelegram.Helpers.Log = (lvl, str) => { }; ``` diff --git a/FAQ.md b/FAQ.md index eb69319..0b15489 100644 --- a/FAQ.md +++ b/FAQ.md @@ -58,15 +58,15 @@ The `access_hash` must usually be provided within the `Input...` structure you p You obtain the `access_hash` through **description structures** like `Channel`, `User`, `Photo`, `Document` that you receive through updates or when you query them through API methods like `Messages_GetAllChats`, `Messages_GetAllDialogs`, `Contacts_ResolveUsername`, etc... *(if you have a `Peer` object, you can convert it to a `User`/`Channel`/`Chat` via the `UserOrChat` helper from the root class that contained the peer)* -Once you obtained the description structure, there are 3 methods for building your `Input...` structure: -* **Recommended:** If you take a look at the **description structure** class or base class `ChatBase/UserBase`, +Once you obtained the description structure, there are 3 methods for building your `Input...` request structure: +* **Recommended:** If you take a look at the **description structure** base class `ChatBase/UserBase`, you will see that they have conversion implicit operators or methods that can create the `Input...` structure for you automatically. So you can just pass that structure you already have, in place of the `Input...` argument, it will work! * Alternatively, you can manually create the `Input...` structure yourself by extracting the `access_hash` from the **description structure** * If you have enabled the [CollectAccessHash system](EXAMPLES.md#collect-access-hash) at the start of your session, it will have collected the `access_hash` automatically when you obtained the description structure. You can then retrieve it with `client.GetAccessHashFor(id)` -⚠️ *An `access_hash` obtained from a User/Channel structure with flag `min` may not be used for most requests. See [Min constructors](https://core.telegram.org/api/min).* +⚠️ *An `access_hash` obtained from a User/Channel structure with flag `min` may not be usable for most requests. See [Min constructors](https://core.telegram.org/api/min).* #### 5. I need to test a feature that has been developed but not yet released in WTelegramClient nuget diff --git a/README.md b/README.md index afd4a89..ff40e98 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-142-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-143-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) @@ -37,7 +37,7 @@ If the account already exists and has enabled two-step verification (2FA) a **pa All these login scenarios are handled automatically within the call to `LoginUserIfNeeded`. And that's it, you now have access to the **[full range of Telegram Client APIs](https://corefork.telegram.org/methods)**. -All those API methods are available *(with an underscore in the method name, instead of a dot)*, like this: `await client.Method_Name(...)` +All those API methods are available in the `TL` namespace *(with an underscore in the method name, instead of a dot)*, like this: `await client.Method_Name(...)` # Saved session If you run this program again, you will notice that only **api_hash** is requested, the other prompts are gone and you are automatically logged-on and ready to go. @@ -96,8 +96,8 @@ Console.WriteLine("This user has joined the following:"); foreach (var (id, chat) in chats.chats) switch (chat) // example of downcasting to their real classes: { - case Chat smallgroup when smallgroup.IsActive: - Console.WriteLine($"{id}: Small group: {smallgroup.title} with {smallgroup.participants_count} members"); + case Chat basicChat when basicChat.IsActive: + Console.WriteLine($"{id}: Basic chat: {basicChat.title} with {basicChat.participants_count} members"); break; case Channel group when group.IsGroup: Console.WriteLine($"{id}: Group {group.username}: {group.title}"); diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 5952c9f..505003e 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -330,15 +330,15 @@ namespace WTelegram /// (optional) Expected file size /// (optional) Callback for tracking the progression of the transfer /// The file type - public async Task DownloadFileAsync(InputFileLocationBase fileLocation, Stream outputStream, int dc_id = 0, int fileSize = 0, ProgressCallback progress = null) + public async Task DownloadFileAsync(InputFileLocationBase fileLocation, Stream outputStream, int dc_id = 0, long fileSize = 0, ProgressCallback progress = null) { Storage_FileType fileType = Storage_FileType.unknown; var client = dc_id == 0 ? this : await GetClientForDC(dc_id, true); using var writeSem = new SemaphoreSlim(1); long streamStartPos = outputStream.Position; - int fileOffset = 0, maxOffsetSeen = 0; + long fileOffset = 0, maxOffsetSeen = 0; long transmitted = 0; - var tasks = new Dictionary(); + var tasks = new Dictionary(); progress?.Invoke(0, fileSize); bool abort = false; while (!abort) @@ -355,7 +355,7 @@ namespace WTelegram break; } - async Task LoadPart(int offset) + async Task LoadPart(long offset) { Upload_FileBase fileBase; try diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 0258bc0..d21f5a4 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -74,6 +74,7 @@ namespace TL public static implicit operator InputMediaPhoto(InputPhoto photo) => new() { id = photo }; } + /// Use the UserOrChat(peer) method from the root class you received, in order to convert this to a more useful or partial class Peer { public abstract long ID { get; } diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index e9c64a6..4237153 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -776,6 +776,8 @@ namespace TL /// If set, this user was reported by many users as a fake or scam user: be careful when interacting with them. fake = 0x4000000, bot_attach_menu = 0x8000000, + premium = 0x10000000, + attach_menu_enabled = 0x20000000, } } @@ -1723,6 +1725,7 @@ namespace TL has_document = 0x1, /// Field has a value has_ttl_seconds = 0x4, + nopremium = 0x8, } } /// Preview of webpage See @@ -1944,16 +1947,28 @@ namespace TL has_info = 0x1, /// Field has a value has_shipping_option_id = 0x2, + recurring_init = 0x4, + recurring_used = 0x8, } } /// A payment was sent See - [TLDef(0x40699CD0)] + [TLDef(0x96163F56)] public class MessageActionPaymentSent : MessageAction { + public Flags flags; /// Three-letter ISO 4217 currency code public string currency; /// Price of the product in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). public long total_amount; + [IfFlag(0)] public string invoice_slug; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_invoice_slug = 0x1, + recurring_init = 0x4, + recurring_used = 0x8, + } } /// A phone call See [TLDef(0x80E11A7F)] @@ -3813,7 +3828,7 @@ namespace TL /// Folder ID public int id; /// Folder info - [IfFlag(0)] public DialogFilter filter; + [IfFlag(0)] public DialogFilterBase filter; [Flags] public enum Flags : uint { @@ -4162,6 +4177,21 @@ namespace TL /// See [TLDef(0x74D8BE99)] public class UpdateSavedRingtones : Update { } + /// See + [TLDef(0x0084CD5A)] + public class UpdateTranscribedAudio : Update + { + public Flags flags; + public Peer peer; + public int msg_id; + public long transcription_id; + public string text; + + [Flags] public enum Flags : uint + { + pending = 0x1, + } + } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -4887,7 +4917,7 @@ namespace TL /// Encrypted file. See /// a null value means encryptedFileEmpty - [TLDef(0x4A70994C)] + [TLDef(0xA8008CD8)] public partial class EncryptedFile : IObject { /// File ID @@ -4895,7 +4925,7 @@ namespace TL /// Checking sum depending on user ID public long access_hash; /// File size in bytes - public int size; + public long size; /// Number of data center public int dc_id; /// 32-bit fingerprint of key used for file encryption @@ -5072,7 +5102,7 @@ namespace TL public long id; } /// Document See - [TLDef(0x1E87342B)] + [TLDef(0x8FD4C4D8)] public partial class Document : DocumentBase { /// Flags, see TL conditional fields @@ -5088,7 +5118,7 @@ namespace TL /// MIME type public string mime_type; /// Size - public int size; + public long size; /// Thumbnails [IfFlag(0)] public PhotoSizeBase[] thumbs; /// Video thumbnails @@ -5864,6 +5894,9 @@ namespace TL has_title = 0x100, } } + /// See + [TLDef(0xED107AB7)] + public class ChatInvitePublicJoinRequests : ExportedChatInvite { } /// Chat invite Derived classes: , , See public abstract class ChatInviteBase : IObject { } @@ -6022,16 +6055,35 @@ namespace TL } /// Info about bots (available bot commands, etc) See - [TLDef(0xE4169B5D)] + [TLDef(0x8F300B57)] public class BotInfo : IObject { + public Flags flags; /// ID of the bot - public long user_id; + [IfFlag(0)] public long user_id; /// Description of the bot - public string description; + [IfFlag(1)] public string description; + [IfFlag(4)] public PhotoBase description_photo; + [IfFlag(5)] public DocumentBase description_document; /// Bot commands that can be used in the chat - public BotCommand[] commands; - public BotMenuButtonBase menu_button; + [IfFlag(2)] public BotCommand[] commands; + [IfFlag(3)] public BotMenuButtonBase menu_button; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_user_id = 0x1, + /// Field has a value + has_description = 0x2, + /// Field has a value + has_commands = 0x4, + /// Field has a value + has_menu_button = 0x8, + /// Field has a value + has_description_photo = 0x10, + /// Field has a value + has_description_document = 0x20, + } } /// Bot or inline keyboard buttons Derived classes: , , , , , , , , , , , , See @@ -8326,7 +8378,7 @@ namespace TL } /// Invoice See - [TLDef(0x0CD886E0)] + [TLDef(0x3E85A91B)] public class Invoice : IObject { /// Flags, see TL conditional fields @@ -8339,6 +8391,7 @@ namespace TL [IfFlag(8)] public long max_tip_amount; /// A vector of suggested amounts of tips in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount. [IfFlag(8)] public long[] suggested_tip_amounts; + [IfFlag(9)] public string recurring_terms_url; [Flags] public enum Flags : uint { @@ -8360,6 +8413,7 @@ namespace TL email_to_provider = 0x80, /// Field has a value has_max_tip_amount = 0x100, + recurring = 0x200, } } @@ -8560,7 +8614,7 @@ namespace TL } /// Payment form See - [TLDef(0x1694761B)] + [TLDef(0xB0133B37)] public class Payments_PaymentForm : IObject { /// Flags, see TL conditional fields @@ -8569,6 +8623,9 @@ namespace TL public long form_id; /// Bot ID public long bot_id; + public string title; + public string description; + [IfFlag(5)] public WebDocumentBase photo; /// Invoice public Invoice invoice; /// Payment provider ID. @@ -8598,6 +8655,8 @@ namespace TL password_missing = 0x8, /// Field has a value has_native_provider = 0x10, + /// Field has a value + has_photo = 0x20, } } @@ -9796,11 +9855,11 @@ namespace TL } /// SHA256 Hash of an uploaded file, to be checked for validity after download See - [TLDef(0x6242C773)] + [TLDef(0xF39B035C)] public class FileHash : IObject { /// Offset from where to start computing SHA-256 hash - public int offset; + public long offset; /// Length public int limit; /// SHA-256 Hash of file chunk, to be checked for validity after download @@ -9875,7 +9934,7 @@ namespace TL /// Secure passport file, for more info see the passport docs » See /// a null value means secureFileEmpty - [TLDef(0xE0277A62)] + [TLDef(0x7D09C27E)] public partial class SecureFile : IObject { /// ID @@ -9883,7 +9942,7 @@ namespace TL /// Access hash public long access_hash; /// File size - public int size; + public long size; /// DC ID public int dc_id; /// Date of upload @@ -10898,7 +10957,7 @@ namespace TL } /// Autodownload settings See - [TLDef(0xE04232F3)] + [TLDef(0x8EFAB953)] public class AutoDownloadSettings : IObject { /// Flags, see TL conditional fields @@ -10906,9 +10965,9 @@ namespace TL /// Maximum size of photos to preload public int photo_size_max; /// Maximum size of videos to preload - public int video_size_max; + public long video_size_max; /// Maximum size of other files to preload - public int file_size_max; + public long file_size_max; /// Maximum suggested bitrate for uploading videos public int video_upload_maxbitrate; @@ -11454,9 +11513,11 @@ namespace TL public BankCardOpenUrl[] open_urls; } + /// Dialog filter (folders) Derived classes: See + public abstract class DialogFilterBase : IObject { } /// Dialog filter AKA folder See [TLDef(0x7438F7E8)] - public class DialogFilter : IObject + public class DialogFilter : DialogFilterBase { /// Flags, see TL conditional fields public Flags flags; @@ -11495,13 +11556,16 @@ namespace TL has_emoticon = 0x2000000, } } + /// See + [TLDef(0x363293AE)] + public class DialogFilterDefault : DialogFilterBase { } /// Suggested folders See [TLDef(0x77744D4A)] public class DialogFilterSuggested : IObject { /// Folder info - public DialogFilter filter; + public DialogFilterBase filter; /// Folder description public string description; } @@ -12744,6 +12808,7 @@ namespace TL inactive = 0x1, /// Field has a value has_around_animation = 0x2, + premium = 0x4, } } @@ -12845,17 +12910,19 @@ namespace TL } /// See - [TLDef(0xE93CB772)] + [TLDef(0xC8AA2CD2)] public class AttachMenuBot : IObject { public Flags flags; public long bot_id; public string short_name; + public AttachMenuPeerType[] peer_types; public AttachMenuBotIcon[] icons; [Flags] public enum Flags : uint { inactive = 0x1, + has_settings = 0x2, } } @@ -12965,4 +13032,69 @@ namespace TL { public DocumentBase document; } + + /// See + public enum AttachMenuPeerType : uint + { + ///See + SameBotPM = 0x7D6BE90E, + ///See + BotPM = 0xC32BFA1A, + ///See + PM = 0xF146D31F, + ///See + Chat = 0x0509113F, + ///See + Broadcast = 0x7BFBDEFC, + } + + /// See + public abstract class InputInvoice : IObject { } + /// See + [TLDef(0xC5B56859)] + public class InputInvoiceMessage : InputInvoice + { + public InputPeer peer; + public int msg_id; + } + /// See + [TLDef(0xC326CAEF)] + public class InputInvoiceSlug : InputInvoice + { + public string slug; + } + + /// See + [TLDef(0xAED0CBD9)] + public class Payments_ExportedInvoice : IObject + { + public string url; + } + + /// See + [TLDef(0x93752C52)] + public class Messages_TranscribedAudio : IObject + { + public Flags flags; + public long transcription_id; + public string text; + + [Flags] public enum Flags : uint + { + pending = 0x1, + } + } + + /// See + [TLDef(0x8A4F3C29)] + public class Help_PremiumPromo : IObject + { + public string status_text; + public MessageEntity[] status_entities; + public string[] video_sections; + public DocumentBase[] videos; + public string currency; + public long monthly_amount; + public Dictionary users; + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 2883d6e..6e3ffeb 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -661,7 +661,7 @@ namespace TL /// Whether to export messages in channels /// Whether to export files /// Maximum size of files to export - public static Task Account_InitTakeoutSession(this Client client, bool contacts = false, bool message_users = false, bool message_chats = false, bool message_megagroups = false, bool message_channels = false, bool files = false, int? file_max_size = null) + public static Task Account_InitTakeoutSession(this Client client, bool contacts = false, bool message_users = false, bool message_chats = false, bool message_megagroups = false, bool message_channels = false, bool files = false, long? file_max_size = null) => client.Invoke(new Account_InitTakeoutSession { flags = (Account_InitTakeoutSession.Flags)((contacts ? 0x1 : 0) | (message_users ? 0x2 : 0) | (message_chats ? 0x4 : 0) | (message_megagroups ? 0x8 : 0) | (message_channels ? 0x10 : 0) | (files ? 0x20 : 0) | (file_max_size != null ? 0x20 : 0)), @@ -1855,7 +1855,7 @@ namespace TL /// SHA256 of file /// Size of the file in bytes /// Mime type - public static Task Messages_GetDocumentByHash(this Client client, byte[] sha256, int size, string mime_type) + public static Task Messages_GetDocumentByHash(this Client client, byte[] sha256, long size, string mime_type) => client.Invoke(new Messages_GetDocumentByHash { sha256 = sha256, @@ -2640,7 +2640,7 @@ namespace TL }); /// Get folders See - public static Task Messages_GetDialogFilters(this Client client) + public static Task Messages_GetDialogFilters(this Client client) => client.Invoke(new Messages_GetDialogFilters { }); @@ -2654,7 +2654,7 @@ namespace TL /// Update folder See Possible codes: 400 (details) /// Folder ID /// Folder info - public static Task Messages_UpdateDialogFilter(this Client client, int id, DialogFilter filter = null) + public static Task Messages_UpdateDialogFilter(this Client client, int id, DialogFilterBase filter = null) => client.Invoke(new Messages_UpdateDialogFilter { flags = (Messages_UpdateDialogFilter.Flags)(filter != null ? 0x1 : 0), @@ -3150,27 +3150,29 @@ namespace TL }); /// See - public static Task Messages_RequestWebView(this Client client, InputPeer peer, InputUserBase bot, bool from_bot_menu = false, bool silent = false, string url = null, string start_param = null, DataJSON theme_params = null, int? reply_to_msg_id = null) + public static Task Messages_RequestWebView(this Client client, InputPeer peer, InputUserBase bot, bool from_bot_menu = false, bool silent = false, string url = null, string start_param = null, DataJSON theme_params = null, int? reply_to_msg_id = null, InputPeer send_as = null) => client.Invoke(new Messages_RequestWebView { - flags = (Messages_RequestWebView.Flags)((from_bot_menu ? 0x10 : 0) | (silent ? 0x20 : 0) | (url != null ? 0x2 : 0) | (start_param != null ? 0x8 : 0) | (theme_params != null ? 0x4 : 0) | (reply_to_msg_id != null ? 0x1 : 0)), + flags = (Messages_RequestWebView.Flags)((from_bot_menu ? 0x10 : 0) | (silent ? 0x20 : 0) | (url != null ? 0x2 : 0) | (start_param != null ? 0x8 : 0) | (theme_params != null ? 0x4 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (send_as != null ? 0x2000 : 0)), peer = peer, bot = bot, url = url, start_param = start_param, theme_params = theme_params, reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), + send_as = send_as, }); /// See - public static Task Messages_ProlongWebView(this Client client, InputPeer peer, InputUserBase bot, long query_id, bool silent = false, int? reply_to_msg_id = null) + public static Task Messages_ProlongWebView(this Client client, InputPeer peer, InputUserBase bot, long query_id, bool silent = false, int? reply_to_msg_id = null, InputPeer send_as = null) => client.Invoke(new Messages_ProlongWebView { - flags = (Messages_ProlongWebView.Flags)((silent ? 0x20 : 0) | (reply_to_msg_id != null ? 0x1 : 0)), + flags = (Messages_ProlongWebView.Flags)((silent ? 0x20 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (send_as != null ? 0x2000 : 0)), peer = peer, bot = bot, query_id = query_id, reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), + send_as = send_as, }); /// See @@ -3201,6 +3203,24 @@ namespace TL data = data, }); + /// See + public static Task Messages_TranscribeAudio(this Client client, InputPeer peer, int msg_id) + => client.Invoke(new Messages_TranscribeAudio + { + peer = peer, + msg_id = msg_id, + }); + + /// See + public static Task Messages_RateTranscribedAudio(this Client client, InputPeer peer, int msg_id, long transcription_id, bool good) + => client.Invoke(new Messages_RateTranscribedAudio + { + peer = peer, + msg_id = msg_id, + transcription_id = transcription_id, + good = good, + }); + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState @@ -3299,7 +3319,7 @@ namespace TL /// File location /// Number of bytes to be skipped /// Number of bytes to be returned - public static Task Upload_GetFile(this Client client, InputFileLocationBase location, int offset = default, int limit = int.MaxValue, bool precise = false, bool cdn_supported = false) + public static Task Upload_GetFile(this Client client, InputFileLocationBase location, long offset = default, int limit = int.MaxValue, bool precise = false, bool cdn_supported = false) => client.Invoke(new Upload_GetFile { flags = (Upload_GetFile.Flags)((precise ? 0x1 : 0) | (cdn_supported ? 0x2 : 0)), @@ -3338,7 +3358,7 @@ namespace TL /// File token /// Offset of chunk to download /// Length of chunk to download - public static Task Upload_GetCdnFile(this Client client, byte[] file_token, int offset = default, int limit = int.MaxValue) + public static Task Upload_GetCdnFile(this Client client, byte[] file_token, long offset = default, int limit = int.MaxValue) => client.Invoke(new Upload_GetCdnFile { file_token = file_token, @@ -3359,7 +3379,7 @@ namespace TL /// Get SHA256 hashes for verifying downloaded CDN files See [bots: ✓] Possible codes: 400 (details) /// File /// Offset from which to start getting hashes - public static Task Upload_GetCdnFileHashes(this Client client, byte[] file_token, int offset = default) + public static Task Upload_GetCdnFileHashes(this Client client, byte[] file_token, long offset = default) => client.Invoke(new Upload_GetCdnFileHashes { file_token = file_token, @@ -3369,7 +3389,7 @@ namespace TL /// Get SHA256 hashes for verifying downloaded files See [bots: ✓] Possible codes: 400 (details) /// File /// Offset from which to get file hashes - public static Task Upload_GetFileHashes(this Client client, InputFileLocationBase location, int offset = default) + public static Task Upload_GetFileHashes(this Client client, InputFileLocationBase location, long offset = default) => client.Invoke(new Upload_GetFileHashes { location = location, @@ -3550,6 +3570,12 @@ namespace TL hash = hash, }); + /// See + public static Task Help_GetPremiumPromo(this Client client) + => client.Invoke(new Help_GetPremiumPromo + { + }); + /// Mark channel/supergroup history as read See Possible codes: 400 (details) /// Channel/supergroup /// ID of message up to which messages should be marked as read @@ -3955,6 +3981,22 @@ namespace TL participant = participant, }); + /// See + public static Task Channels_ToggleJoinToSend(this Client client, InputChannelBase channel, bool enabled) + => client.Invoke(new Channels_ToggleJoinToSend + { + channel = channel, + enabled = enabled, + }); + + /// See + public static Task Channels_ToggleJoinRequest(this Client client, InputChannelBase channel, bool enabled) + => client.Invoke(new Channels_ToggleJoinRequest + { + channel = channel, + enabled = enabled, + }); + /// Sends a custom request; for bots only See [bots: ✓] Possible codes: 400,403 (details) /// The method name /// JSON-serialized method parameters @@ -4037,15 +4079,12 @@ namespace TL }); /// Get a payment form See Possible codes: 400 (details) - /// The peer where the payment form was sent - /// Message ID of payment form /// A JSON object with the following keys, containing color theme information (integers, RGB24) to pass to the payment provider, to apply in eventual verification pages:
bg_color - Background color
text_color - Text color
hint_color - Hint text color
link_color - Link color
button_color - Button color
button_text_color - Button text color - public static Task Payments_GetPaymentForm(this Client client, InputPeer peer, int msg_id, DataJSON theme_params = null) + public static Task Payments_GetPaymentForm(this Client client, InputInvoice invoice, DataJSON theme_params = null) => client.Invoke(new Payments_GetPaymentForm { flags = (Payments_GetPaymentForm.Flags)(theme_params != null ? 0x1 : 0), - peer = peer, - msg_id = msg_id, + invoice = invoice, theme_params = theme_params, }); @@ -4061,33 +4100,27 @@ namespace TL /// Submit requested order information for validation See Possible codes: 400 (details) /// Save order information to re-use it for future orders - /// Peer where the payment form was sent - /// Message ID of payment form /// Requested order information - public static Task Payments_ValidateRequestedInfo(this Client client, InputPeer peer, int msg_id, PaymentRequestedInfo info, bool save = false) + public static Task Payments_ValidateRequestedInfo(this Client client, InputInvoice invoice, PaymentRequestedInfo info, bool save = false) => client.Invoke(new Payments_ValidateRequestedInfo { flags = (Payments_ValidateRequestedInfo.Flags)(save ? 0x1 : 0), - peer = peer, - msg_id = msg_id, + invoice = invoice, info = info, }); /// Send compiled payment form See Possible codes: 400 (details) /// Form ID - /// The peer where the payment form was sent - /// Message ID of form /// ID of saved and validated /// Chosen shipping option ID /// Payment credentials /// Tip, in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). - public static Task Payments_SendPaymentForm(this Client client, long form_id, InputPeer peer, int msg_id, InputPaymentCredentialsBase credentials, string requested_info_id = null, string shipping_option_id = null, long? tip_amount = null) + public static Task Payments_SendPaymentForm(this Client client, long form_id, InputInvoice invoice, InputPaymentCredentialsBase credentials, string requested_info_id = null, string shipping_option_id = null, long? tip_amount = null) => client.Invoke(new Payments_SendPaymentForm { flags = (Payments_SendPaymentForm.Flags)((requested_info_id != null ? 0x1 : 0) | (shipping_option_id != null ? 0x2 : 0) | (tip_amount != null ? 0x4 : 0)), form_id = form_id, - peer = peer, - msg_id = msg_id, + invoice = invoice, requested_info_id = requested_info_id, shipping_option_id = shipping_option_id, credentials = credentials, @@ -4117,6 +4150,51 @@ namespace TL number = number, }); + /// See + public static Task Payments_ExportInvoice(this Client client, InputMedia invoice_media) + => client.Invoke(new Payments_ExportInvoice + { + invoice_media = invoice_media, + }); + + /// See + public static Task Payments_AssignAppStoreTransaction(this Client client, string transaction_id, byte[] receipt, bool restore = false) + => client.Invoke(new Payments_AssignAppStoreTransaction + { + flags = (Payments_AssignAppStoreTransaction.Flags)(restore ? 0x1 : 0), + transaction_id = transaction_id, + receipt = receipt, + }); + + /// See + public static Task Payments_AssignPlayMarketTransaction(this Client client, string purchase_token) + => 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, + }); + + /// See + public static Task Payments_CanPurchasePremium(this Client client) + => client.Invoke(new Payments_CanPurchasePremium + { + }); + + /// See + public static Task Payments_RequestRecurringPayment(this Client client, InputUserBase user_id, string recurring_init_charge, InputMedia invoice_media) + => client.Invoke(new Payments_RequestRecurringPayment + { + user_id = user_id, + recurring_init_charge = recurring_init_charge, + invoice_media = invoice_media, + }); + /// Create a stickerset, bots only. See [bots: ✓] Possible codes: 400 (details) /// Whether this is a mask stickerset /// Whether this is an animated stickerset @@ -5141,11 +5219,11 @@ namespace TL.Methods public string code; } - [TLDef(0xF05B4804)] + [TLDef(0x8EF3EAB0)] public class Account_InitTakeoutSession : IMethod { public Flags flags; - [IfFlag(5)] public int file_max_size; + [IfFlag(5)] public long file_max_size; [Flags] public enum Flags : uint { @@ -6130,11 +6208,11 @@ namespace TL.Methods } } - [TLDef(0x338E2464)] + [TLDef(0xB1F2061F)] public class Messages_GetDocumentByHash : IMethod { public byte[] sha256; - public int size; + public long size; public string mime_type; } @@ -6817,7 +6895,7 @@ namespace TL.Methods } [TLDef(0xF19ED96D)] - public class Messages_GetDialogFilters : IMethod { } + public class Messages_GetDialogFilters : IMethod { } [TLDef(0xA29CD42C)] public class Messages_GetSuggestedDialogFilters : IMethod { } @@ -6827,7 +6905,7 @@ namespace TL.Methods { public Flags flags; public int id; - [IfFlag(0)] public DialogFilter filter; + [IfFlag(0)] public DialogFilterBase filter; [Flags] public enum Flags : uint { @@ -7221,7 +7299,7 @@ namespace TL.Methods public bool enabled; } - [TLDef(0x0FA04DFF)] + [TLDef(0x91B15831)] public class Messages_RequestWebView : IMethod { public Flags flags; @@ -7231,6 +7309,7 @@ namespace TL.Methods [IfFlag(3)] public string start_param; [IfFlag(2)] public DataJSON theme_params; [IfFlag(0)] public int reply_to_msg_id; + [IfFlag(13)] public InputPeer send_as; [Flags] public enum Flags : uint { @@ -7240,10 +7319,11 @@ namespace TL.Methods has_start_param = 0x8, from_bot_menu = 0x10, silent = 0x20, + has_send_as = 0x2000, } } - [TLDef(0xD22AD148)] + [TLDef(0xEA5FBCCE)] public class Messages_ProlongWebView : IMethod { public Flags flags; @@ -7251,11 +7331,13 @@ namespace TL.Methods public InputUserBase bot; public long query_id; [IfFlag(0)] public int reply_to_msg_id; + [IfFlag(13)] public InputPeer send_as; [Flags] public enum Flags : uint { has_reply_to_msg_id = 0x1, silent = 0x20, + has_send_as = 0x2000, } } @@ -7289,6 +7371,22 @@ namespace TL.Methods public string data; } + [TLDef(0x269E9A49)] + public class Messages_TranscribeAudio : IMethod + { + public InputPeer peer; + public int msg_id; + } + + [TLDef(0x7F1D072F)] + public class Messages_RateTranscribedAudio : IMethod + { + public InputPeer peer; + public int msg_id; + public long transcription_id; + public bool good; + } + [TLDef(0xEDD4882A)] public class Updates_GetState : IMethod { } @@ -7367,12 +7465,12 @@ namespace TL.Methods public byte[] bytes; } - [TLDef(0xB15A9AFC)] + [TLDef(0xBE5335BE)] public class Upload_GetFile : IMethod { public Flags flags; public InputFileLocationBase location; - public int offset; + public long offset; public int limit; [Flags] public enum Flags : uint @@ -7399,11 +7497,11 @@ namespace TL.Methods public int limit; } - [TLDef(0x2000BCC3)] + [TLDef(0x395F69DA)] public class Upload_GetCdnFile : IMethod { public byte[] file_token; - public int offset; + public long offset; public int limit; } @@ -7414,18 +7512,18 @@ namespace TL.Methods public byte[] request_token; } - [TLDef(0x4DA54231)] + [TLDef(0x91DC3F31)] public class Upload_GetCdnFileHashes : IMethod { public byte[] file_token; - public int offset; + public long offset; } - [TLDef(0xC7025931)] + [TLDef(0x9156982A)] public class Upload_GetFileHashes : IMethod { public InputFileLocationBase location; - public int offset; + public long offset; } [TLDef(0xC4F9186B)] @@ -7538,6 +7636,9 @@ namespace TL.Methods public int hash; } + [TLDef(0xB81B93D4)] + public class Help_GetPremiumPromo : IMethod { } + [TLDef(0xCC104937)] public class Channels_ReadHistory : IMethod { @@ -7844,6 +7945,20 @@ namespace TL.Methods public InputPeer participant; } + [TLDef(0xE4CB9580)] + public class Channels_ToggleJoinToSend : IMethod + { + public InputChannelBase channel; + public bool enabled; + } + + [TLDef(0x4C2985B6)] + public class Channels_ToggleJoinRequest : IMethod + { + public InputChannelBase channel; + public bool enabled; + } + [TLDef(0xAA2769ED)] public class Bots_SendCustomRequest : IMethod { @@ -7905,12 +8020,11 @@ namespace TL.Methods public ChatAdminRights admin_rights; } - [TLDef(0x8A333C8D)] + [TLDef(0x37148DBB)] public class Payments_GetPaymentForm : IMethod { public Flags flags; - public InputPeer peer; - public int msg_id; + public InputInvoice invoice; [IfFlag(0)] public DataJSON theme_params; [Flags] public enum Flags : uint @@ -7926,12 +8040,11 @@ namespace TL.Methods public int msg_id; } - [TLDef(0xDB103170)] + [TLDef(0xB6C8F12B)] public class Payments_ValidateRequestedInfo : IMethod { public Flags flags; - public InputPeer peer; - public int msg_id; + public InputInvoice invoice; public PaymentRequestedInfo info; [Flags] public enum Flags : uint @@ -7940,13 +8053,12 @@ namespace TL.Methods } } - [TLDef(0x30C3BC9D)] + [TLDef(0x2D03522F)] public class Payments_SendPaymentForm : IMethod { public Flags flags; public long form_id; - public InputPeer peer; - public int msg_id; + public InputInvoice invoice; [IfFlag(0)] public string requested_info_id; [IfFlag(1)] public string shipping_option_id; public InputPaymentCredentialsBase credentials; @@ -7981,6 +8093,48 @@ namespace TL.Methods public string number; } + [TLDef(0x0F91B065)] + public class Payments_ExportInvoice : IMethod + { + public InputMedia invoice_media; + } + + [TLDef(0x0FEC13C6)] + public class Payments_AssignAppStoreTransaction : IMethod + { + public Flags flags; + public string transaction_id; + public byte[] receipt; + + [Flags] public enum Flags : uint + { + restore = 0x1, + } + } + + [TLDef(0x4FAA4AED)] + public class Payments_AssignPlayMarketTransaction : IMethod + { + public string purchase_token; + } + + [TLDef(0xD164E36A)] + public class Payments_RestorePlayMarketReceipt : IMethod + { + public byte[] receipt; + } + + [TLDef(0xAA6A90C8)] + public class Payments_CanPurchasePremium : IMethod { } + + [TLDef(0x146E958D)] + public class Payments_RequestRecurringPayment : IMethod + { + public InputUserBase user_id; + public string recurring_init_charge; + public InputMedia invoice_media; + } + [TLDef(0x9021AB67)] public class Stickers_CreateStickerSet : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index b66997d..6cadf0d 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 = 142; // fetched 14/05/2022 22:26:18 + public const int Version = 143; // fetched 14/06/2022 23:30:05 internal const uint VectorCtor = 0x1CB5C415; internal const uint NullCtor = 0x56730BCC; internal const uint RpcResultCtor = 0xF35C6D01; @@ -170,7 +170,7 @@ namespace TL [0x9FBAB604] = typeof(MessageActionHistoryClear), [0x92A72876] = typeof(MessageActionGameScore), [0x8F31B327] = typeof(MessageActionPaymentSentMe), - [0x40699CD0] = typeof(MessageActionPaymentSent), + [0x96163F56] = typeof(MessageActionPaymentSent), [0x80E11A7F] = typeof(MessageActionPhoneCall), [0x4792929B] = typeof(MessageActionScreenshotTaken), [0xFAE69F56] = typeof(MessageActionCustomAction), @@ -349,6 +349,7 @@ namespace TL [0x1592B79D] = typeof(UpdateWebViewResultSent), [0x14B85813] = typeof(UpdateBotMenuButton), [0x74D8BE99] = typeof(UpdateSavedRingtones), + [0x0084CD5A] = typeof(UpdateTranscribedAudio), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -379,7 +380,7 @@ namespace TL [0x1E1C7C45] = typeof(EncryptedChatDiscarded), [0xF141B5E1] = typeof(InputEncryptedChat), [0xC21F497E] = null,//EncryptedFileEmpty - [0x4A70994C] = typeof(EncryptedFile), + [0xA8008CD8] = typeof(EncryptedFile), [0x1837C364] = null,//InputEncryptedFileEmpty [0x64BD0306] = typeof(InputEncryptedFileUploaded), [0x5A17B5E5] = typeof(InputEncryptedFile), @@ -393,7 +394,7 @@ namespace TL [0x72F0EAAE] = null,//InputDocumentEmpty [0x1ABFB575] = typeof(InputDocument), [0x36F8C871] = typeof(DocumentEmpty), - [0x1E87342B] = typeof(Document), + [0x8FD4C4D8] = typeof(Document), [0x17C6B5F6] = typeof(Help_Support), [0x9FD40BD8] = typeof(NotifyPeer), [0xB4C83B4C] = typeof(NotifyUsers), @@ -461,6 +462,7 @@ namespace TL [0x137948A5] = typeof(Auth_PasswordRecovery), [0xA384B779] = typeof(ReceivedNotifyMessage), [0x0AB4A819] = typeof(ChatInviteExported), + [0xED107AB7] = typeof(ChatInvitePublicJoinRequests), [0x5A686D7C] = typeof(ChatInviteAlready), [0x300C44C1] = typeof(ChatInvite), [0x61695CB0] = typeof(ChatInvitePeek), @@ -474,7 +476,7 @@ namespace TL [0xB60A24A6] = typeof(Messages_StickerSet), [0xD3F924EB] = null,//Messages_StickerSetNotModified [0xC27AC8C7] = typeof(BotCommand), - [0xE4169B5D] = typeof(BotInfo), + [0x8F300B57] = typeof(BotInfo), [0xA2FA4880] = typeof(KeyboardButton), [0x258AFF05] = typeof(KeyboardButtonUrl), [0x35BBDB6B] = typeof(KeyboardButtonCallback), @@ -649,7 +651,7 @@ namespace TL [0xA44F3EF6] = typeof(PageBlockMap), [0x7D748D04] = typeof(DataJSON), [0xCB296BF8] = typeof(LabeledPrice), - [0x0CD886E0] = typeof(Invoice), + [0x3E85A91B] = typeof(Invoice), [0xEA02C27E] = typeof(PaymentCharge), [0x1E8CAAEB] = typeof(PostAddress), [0x909C3F94] = typeof(PaymentRequestedInfo), @@ -660,7 +662,7 @@ namespace TL [0xC239D686] = typeof(InputWebFileLocation), [0x9F2221C9] = typeof(InputWebFileGeoPointLocation), [0x21E753BC] = typeof(Upload_WebFile), - [0x1694761B] = typeof(Payments_PaymentForm), + [0xB0133B37] = typeof(Payments_PaymentForm), [0xD1451883] = typeof(Payments_ValidatedRequestedInfo), [0x4E5F810D] = typeof(Payments_PaymentResult), [0xD8411139] = typeof(Payments_PaymentVerificationNeeded), @@ -754,14 +756,14 @@ namespace TL [0x514519E2] = typeof(DialogPeerFolder), [0x0D54B65D] = null,//Messages_FoundStickerSetsNotModified [0x8AF09DD2] = typeof(Messages_FoundStickerSets), - [0x6242C773] = typeof(FileHash), + [0xF39B035C] = typeof(FileHash), [0x75588B3F] = typeof(InputClientProxy), [0xE3309F7F] = typeof(Help_TermsOfServiceUpdateEmpty), [0x28ECF961] = typeof(Help_TermsOfServiceUpdate), [0x3334B0F0] = typeof(InputSecureFileUploaded), [0x5367E5BE] = typeof(InputSecureFile), [0x64199744] = null,//SecureFileEmpty - [0xE0277A62] = typeof(SecureFile), + [0x7D09C27E] = typeof(SecureFile), [0x8AEABEC3] = typeof(SecureData), [0x7D6099DD] = typeof(SecurePlainPhone), [0x21EC5A5F] = typeof(SecurePlainEmail), @@ -831,7 +833,7 @@ namespace TL [0xCDC3858C] = typeof(Account_WallPapers), [0x8A6469C2] = typeof(CodeSettings), [0x1DC1BCA4] = typeof(WallPaperSettings), - [0xE04232F3] = typeof(AutoDownloadSettings), + [0x8EFAB953] = typeof(AutoDownloadSettings), [0x63CACF26] = typeof(Account_AutoDownloadSettings), [0xD5B3B9F9] = typeof(EmojiKeyword), [0x236DF622] = typeof(EmojiKeywordDeleted), @@ -870,6 +872,7 @@ namespace TL [0xF568028A] = typeof(BankCardOpenUrl), [0x3E24E573] = typeof(Payments_BankCardData), [0x7438F7E8] = typeof(DialogFilter), + [0x363293AE] = typeof(DialogFilterDefault), [0x77744D4A] = typeof(DialogFilterSuggested), [0xB637EDAF] = typeof(StatsDateRangeDays), [0xCB43ACDE] = typeof(StatsAbsValueAndPrev), @@ -954,7 +957,7 @@ namespace TL [0x2DBF3432] = typeof(Phone_GroupCallStreamRtmpUrl), [0x4576F3F0] = typeof(AttachMenuBotIconColor), [0xB2A7386B] = typeof(AttachMenuBotIcon), - [0xE93CB772] = typeof(AttachMenuBot), + [0xC8AA2CD2] = typeof(AttachMenuBot), [0xF1D88A5C] = null,//AttachMenuBotsNotModified [0x3C4301C0] = typeof(AttachMenuBots), [0x93BF667F] = typeof(AttachMenuBotsBot), @@ -972,6 +975,11 @@ namespace TL [0xFF6C8049] = typeof(NotificationSoundRingtone), [0xB7263F6D] = typeof(Account_SavedRingtone), [0x1F307EB7] = typeof(Account_SavedRingtoneConverted), + [0xC5B56859] = typeof(InputInvoiceMessage), + [0xC326CAEF] = typeof(InputInvoiceSlug), + [0xAED0CBD9] = typeof(Payments_ExportedInvoice), + [0x93752C52] = typeof(Messages_TranscribedAudio), + [0x8A4F3C29] = typeof(Help_PremiumPromo), // from TL.Secret: [0xBB718624] = typeof(Layer66.SendMessageUploadRoundAction), [0xE50511D8] = typeof(Layer45.DecryptedMessageMediaWebPage),